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

Unified Diff: runtime/vm/snapshot.cc

Issue 2650693004: VM: Fix memory leaks during isolate spawning (Closed)
Patch Set: Rebased & Renamed TakeBuffer -> StealBuffer Created 3 years, 11 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 | « runtime/vm/snapshot.h ('k') | tests/isolate/isolate.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot.cc
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index cb9dfde5778a5b8fd62413cb0c0d9ad33d04f408..669df78bd8ba604dba9ff5513e52cc7db4df7f35 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -1908,7 +1908,8 @@ void SnapshotWriterVisitor::VisitPointers(RawObject** first, RawObject** last) {
MessageWriter::MessageWriter(uint8_t** buffer,
ReAlloc alloc,
DeAlloc dealloc,
- bool can_send_any_object)
+ bool can_send_any_object,
+ intptr_t* buffer_len)
: SnapshotWriter(Thread::Current(),
Snapshot::kMessage,
buffer,
@@ -1917,7 +1918,8 @@ MessageWriter::MessageWriter(uint8_t** buffer,
kInitialSize,
&forward_list_,
can_send_any_object),
- forward_list_(thread(), kMaxPredefinedObjectIds) {
+ forward_list_(thread(), kMaxPredefinedObjectIds),
+ buffer_len_(buffer_len) {
ASSERT(buffer != NULL);
ASSERT(alloc != NULL);
}
@@ -1933,6 +1935,9 @@ void MessageWriter::WriteMessage(const Object& obj) {
if (setjmp(*jump.Set()) == 0) {
NoSafepointScope no_safepoint;
WriteObject(obj.raw());
+ if (buffer_len_ != NULL) {
+ *buffer_len_ = BytesWritten();
+ }
} else {
FreeBuffer();
ThrowException(exception_type(), exception_msg());
« no previous file with comments | « runtime/vm/snapshot.h ('k') | tests/isolate/isolate.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698