slab_allocator: fix leak of Persistent handles

pull/24503/head
Shigeki Ohtsu 2012-06-05 19:24:15 +09:00 committed by Ben Noordhuis
parent b9e40fbaac
commit 208d1715a7
1 changed files with 3 additions and 3 deletions

View File

@ -49,10 +49,10 @@ SlabAllocator::SlabAllocator(unsigned int size) {
SlabAllocator::~SlabAllocator() {
if (!initialized_) return;
slab_sym_.Clear();
slab_sym_.Dispose();
slab_.Clear();
slab_sym_.Clear();
slab_.Dispose();
slab_.Clear();
}
@ -92,8 +92,8 @@ char* SlabAllocator::Allocate(Handle<Object> obj, unsigned int size) {
}
if (slab_.IsEmpty() || offset_ + size > size_) {
slab_.Clear();
slab_.Dispose();
slab_.Clear();
slab_ = Persistent<Object>::New(NewSlab(size_));
offset_ = 0;
last_ptr_ = NULL;