Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Unified Diff: runtime/vm/dart_api_message.cc

Issue 14031006: Fix incremental allocation of forward_list_ in dart_api_message. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_message.cc
diff --git a/runtime/vm/dart_api_message.cc b/runtime/vm/dart_api_message.cc
index 34eb977808d8017cfd24e71b1948b3c7aa427fd0..5df30aa2fa46c81e2c09c7517e5d530a4c751b87 100644
--- a/runtime/vm/dart_api_message.cc
+++ b/runtime/vm/dart_api_message.cc
@@ -809,10 +809,12 @@ void ApiMessageWriter::AddToForwardList(Dart_CObject* object) {
if (forward_id_ >= forward_list_length_) {
void* new_list = NULL;
if (forward_list_length_ == 0) {
- intptr_t new_size = 4 * sizeof(object);
+ forward_list_length_ = 4;
+ intptr_t new_size = forward_list_length_ * sizeof(object);
new_list = ::malloc(new_size);
} else {
- intptr_t new_size = (forward_list_length_ * sizeof(object)) * 2;
+ forward_list_length_ *= 2;
+ intptr_t new_size = (forward_list_length_ * sizeof(object));
new_list = ::realloc(forward_list_, new_size);
}
ASSERT(new_list != NULL);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698