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

Unified Diff: src/natives-external.cc

Issue 960883003: Fix memory leak in natives-external. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « src/natives.h ('k') | src/snapshot-empty.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/natives-external.cc
diff --git a/src/natives-external.cc b/src/natives-external.cc
index e601808fe8182055683d32133081b36e46c9938f..109f9c5f47bfe14cf25a69365502ac1ef7993df7 100644
--- a/src/natives-external.cc
+++ b/src/natives-external.cc
@@ -132,6 +132,10 @@ class NativesHolder {
DCHECK(store);
holder_ = store;
}
+ static void Dispose() {
+ DCHECK(holder_);
+ delete holder_;
+ }
private:
static NativesStore* holder_;
@@ -157,6 +161,15 @@ void SetNativesFromFile(StartupData* natives_blob) {
}
+/**
+ * Release memory allocated by SetNativesFromFile.
+ */
+void DisposeNatives() {
+ NativesHolder<CORE>::Dispose();
+ NativesHolder<EXPERIMENTAL>::Dispose();
+}
+
+
// Implement NativesCollection<T> bsaed on NativesHolder + NativesStore.
//
// (The callers expect a purely static interface, since this is how the
« no previous file with comments | « src/natives.h ('k') | src/snapshot-empty.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698