If this belongs in the v8-dev group please let me know.

I have a pool of Isolates that I manage and use to run scripts on various 
threads.
I'm using Lockers, scopes etc... appropriately.  The scripts are running 
great.

However, at service shutdown time I iterate the Isolates and destroy them 
one at a time like this:

m_pIsolate->Enter();

//Tell V8 that the JS Objects it is keeping alive are holding on to lots of 
C++ native memory so it will trigger GC and call our MakeWeak destructor 
callbacks!
m_pIsolate->AdjustAmountOfExternalAllocatedMemory(1025*1024*100);   
 //Pretend 100 MB is being held in our objects
V8::ContextDisposedNotification();  //Necessary to trigger GC.
while(!V8::IdleNotification(5000)) {};  //Try to trigger garbage collection 
in V8
   
m_pIsolate->Exit();
m_pIsolate->Dispose();
m_pIsolate= NULL;

When I do, I get this:

#
# Fatal error in ..\..\src\heap.cc, line 438
# CHECK(allocation_allowed_ && gc_state_ == NOT_IN_GC) failed
#

Any ideas on what this means and why its happening?

*Here is the call stack:*

v8::internal::OS::DebugBreak()  Line 1000 C++
v8::internal::OS::Abort()  Line 991 C++
V8_Fatal(const char * file=0x009d04d4, int line=438, const char * 
format=0x009d04c0, ...)  Line 61 C++
v8::internal::Heap::GarbageCollectionPrologue()  Line 438 + 0x33 bytes C++
v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace 
space=OLD_POINTER_SPACE, v8::internal::GarbageCollector 
collector=MARK_COMPACTOR, const char * gc_reason=0x009d37f8, const char * 
collector_reason=0x009d014c)  Line 644 C++
v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace 
space=OLD_POINTER_SPACE, const char * gc_reason=0x009d37f8)  Line 482 C++
v8::internal::Heap::CollectAllGarbage(int flags=2, const char * 
gc_reason=0x009d37f8)  Line 566 C++
v8::internal::Heap::IdleNotification(int hint=5000)  Line 5683 C++
v8::internal::V8::IdleNotification(int hint=5000)  Line 195 C++
v8::V8::IdleNotification(int hint=5000)  Line 4837 + 0x9 bytes C++

*At crash time gc_state_  is set to MARK_COMPACT*
*gc_count_  is 24*


*Here's the V8 code causing the pain:*

void Heap::GarbageCollectionPrologue() {
  isolate_->transcendental_cache()->Clear();
  ClearJSFunctionResultCaches();
  gc_count_++;
  unflattened_strings_length_ = 0;

  if (FLAG_flush_code && FLAG_flush_code_incrementally) {
    mark_compact_collector()->EnableCodeFlushing(true);
  }

#ifdef VERIFY_HEAP
  if (FLAG_verify_heap) {
    Verify();
  }
#endif

#ifdef DEBUG
  ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC);
  allow_allocation(false);

  if (FLAG_gc_verbose) Print();

  ReportStatisticsBeforeGC();
#endif  // DEBUG

  store_buffer()->GCPrologue();
}

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to