Hi Sylvain, there is a bug in that sample. Two persistent handles are allocated for each context and only one of the is disposed. Context::New returns a persistent handle directly. I will fix the sample today.
Thanks for noticing! Cheers, -- Mads On Tue, Nov 23, 2010 at 7:30 PM, Sylvain <[email protected]> wrote: > Hello, > > I've been playing with the process.cc sample and I found that v8 heap > size keeps growing when running the code several time. > > What I am doing is as simple as calling the main function of > process.cc in a loop. > > I renamed process.cc main() by start(), and added: > > int main(int ac, char **av) { > for (int i = 0; i < ANY_NUMBER; ++i) { > start(ac, av); > > HeapStatistics hs; > v8::V8::ContextDisposedNotification(); > v8::V8::LowMemoryNotification(); > while(!v8::V8::IdleNotification()); > v8::V8::GetHeapStatistics(&hs); > printf("Heap: %.2f/%.2f MB\n", hs.used_heap_size() / 1024.0 / > 1024.0, hs.total_heap_size() / 1024.0 / 1024.0); > } > return 0; > } > > and I get something like: > > Heap: 0.74/3.63 MB > Heap: 0.84/3.90 MB > Heap: 0.94/3.93 MB > Heap: 1.04/3.96 MB > Heap: 1.15/3.99 MB > Heap: 1.25/4.03 MB > Heap: 1.35/4.30 MB > Heap: 1.45/4.33 MB > Heap: 1.56/4.36 MB > Heap: 1.66/4.39 MB > ... and so on ... > > It looks to me as if it is related to the context being reused/ > reallocated. > If that's so, how can I reuse the context in the processor? > > Thanks in advance, > > -- > Sylvain > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
