This fixes 4 leaks, returning 196 bytes of lost memory.
Review URL: https://chromiumcodereview.appspot.com/
9864034
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11184
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
}
+void RegisteredExtension::UnregisterAll() {
+ RegisteredExtension* re = first_extension_;
+ while (re != NULL) {
+ RegisteredExtension* next = re->next();
+ delete re;
+ re = next;
+ }
+}
+
+
void RegisterExtension(Extension* that) {
RegisteredExtension* extension = new RegisteredExtension(that);
RegisteredExtension::Register(extension);
public:
explicit RegisteredExtension(Extension* extension);
static void Register(RegisteredExtension* that);
+ static void UnregisterAll();
Extension* extension() { return extension_; }
RegisteredExtension* next() { return next_; }
RegisteredExtension* next_auto() { return next_auto_; }
void ExternalizeStringExtension::Register() {
- static ExternalizeStringExtension* externalize_extension = NULL;
- if (externalize_extension == NULL)
- externalize_extension = new ExternalizeStringExtension;
- static v8::DeclareExtension externalize_extension_declaration(
- externalize_extension);
+ static ExternalizeStringExtension externalize_extension;
+ static v8::DeclareExtension declaration(&externalize_extension);
}
} } // namespace v8::internal
void GCExtension::Register() {
- static GCExtension* gc_extension = NULL;
- if (gc_extension == NULL) gc_extension = new GCExtension();
- static v8::DeclareExtension gc_extension_declaration(gc_extension);
+ static GCExtension gc_extension;
+ static v8::DeclareExtension declaration(&gc_extension);
}
} } // namespace v8::internal
ElementsAccessor::TearDown();
LOperand::TearDownCaches();
+ RegisteredExtension::UnregisterAll();
isolate->TearDown();
delete isolate;