Releasing allocated chunks in Pool's destructor.
authorantonm@chromium.org <antonm@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 28 Jul 2010 12:34:41 +0000 (12:34 +0000)
committerantonm@chromium.org <antonm@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 28 Jul 2010 12:34:41 +0000 (12:34 +0000)
That should make it not leak if v8 wasn't intialized at all.

Review URL: http://codereview.chromium.org/3048034

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5142 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/global-handles.cc

index 573669a..f089b85 100644 (file)
@@ -226,6 +226,12 @@ class GlobalHandles::Pool BASE_EMBEDDED {
       limit_ = current_->nodes + kNodesPerChunk;
     }
 
+    ~Pool() {
+      if (current_ != NULL) {
+        Release();
+      }
+    }
+
     Node* Allocate() {
       if (next_ < limit_) {
         return next_++;