Nope.
I want to dispose the old one, call GC and get everything cleaned up.
Regards,
Florent
Le lundi 5 novembre 2012 09:33:56 UTC+1, Yang Guo a écrit :
>
> I still think that what you want is to create a new context and dispose
> the old one.
>
> Yang
>
>
> On Tuesday, October 30, 2012 12:05:12 PM UTC+1, Florent S. wrote:
>>
>> Thanks Yang.
>>
>> That's what I suspected.
>> If I wnd = null; at the end of my script GC() clean up everything.
>>
>> So I added this after my script run :
>>
>> HObject o = GlobalContext->Global();
>> HArray a = o->GetPropertyNames();
>> for (int i = a->Length() -1; i >= 0; i--)
>> {
>> HValue k = a->Get(i);
>> HValue v = o->Get(k);
>> o->Set(k, Null());
>> }
>> while(!V8::IdleNotification()) {} // GC
>>
>> V8::IdleNotification cleans up few thing but not my Window C++ object
>> whereas wnd is null ...
>>
>> So eventually, I run a clean up script after my first one :
>>
>> for (var i in this) {
>> this[i] = null;
>> }
>>
>> And at last, every thing is cleaned up !
>>
>> Thanks for the support,
>> Florent
>>
>> Le lundi 29 octobre 2012 09:58:57 UTC+1, Yang Guo a écrit :
>>>
>>> What you want is to dispose the context and create a new one. You can
>>> find an example for this in d8.cc. There should be no cross-context memory
>>> leaks (if you find one, report it!).
>>>
>>> In the specific case of your example, (if understood it correctly) the
>>> property "wnd" of the global object is set to the new Window object,
>>> retaining it in memory. GC won't touch it since the object is reachable
>>> through the global object. Setting wnd to undefined will break that link
>>> and cause the GC to step in eventually.
>>>
>>> Yang
>>>
>>>
>>> On Saturday, October 27, 2012 2:59:10 PM UTC+2, Florent S. wrote:
>>>>
>>>> Hi there !
>>>>
>>>> I would like to know if there is a way to force V8 to release ALL the
>>>> objects in memory.
>>>>
>>>> After I executed my script, I would like to free all memory that has
>>>> been allocated during the script in the embedded object.
>>>> I already the "MakeWeak" mechanism and it works when V8 does a garbage
>>>> collection. But if my script is like :
>>>>
>>>> // begin
>>>> var wnd = new Window();
>>>> // end
>>>>
>>>> The C++ object embedded in Window will never been destroyed, resulting
>>>> of course memory leaks.
>>>>
>>>> I've tried to do a v8::V8::Dispose() but it doesn't help.
>>>>
>>>> Is there any way to totally clean up the memory without exiting my
>>>> application ?
>>>>
>>>> Best regards,
>>>> Florent
>>>>
>>>> P.S: My application is under Windows 32b
>>>>
>>>
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users