I did try GC .but the problem is the handle is never destroyed nor
made weak for garbage collection to claim it.

So even if GC runs it would never think of freeing the nodes since i
saw that GC actually realcaims only tose nodes whose state is WEAK

And there is no access to make the Globalhandle/node weak since
Genesis object is just created as a local object in function
Handle<Context> Bootstrapper::CreateEnvironment(
    Handle<Object> global_object,
    v8::Handle<v8::ObjectTemplate> global_template,
    v8::ExtensionConfiguration* extensions) {
  Genesis genesis(global_object, global_template, extensions);

Can anyone please help me out on this. I tried calling
GlobalHandles::Destroy(reinterpret_cast<Object**>
(genesis.global_context().location()));

in Genesis object destructor .but the node is still in use by the
Contxt object created . so i would get a seg fault.

Can anyone please help me out on this. Can anyone suggest where should
i have this GlobalHandles::Destroy so that the memory would get freed
and it would not result in seg fault also.

this is the order of calls leading to leak
v8::Context::New > >> (v8::ExtensionConfiguration*,
v8::Handle<v8::ObjectTemplate>,> >> v8::Handle<v8::Value>) api.cc:
2265)
by 0x812EE69: v8::internal::Bootstrapper::CreateEnvironment >>
(bootstrapper.cc:346)
 by 0x812ED77: v8::internal::Genesis::Genesis> >>
(v8::internal::Handle<v8::internal::Object>> >> (bootstrapper.cc:1454)
 by 0x8129C67: v8::internal::Genesis::CreateRoots> >>
(v8::Handle<v8::ObjectTemplate>,> >>  (bootstrapper.cc:463)
 by 0x815B1C4: v8::internal::GlobalHandles::Create> >>
(v8::internal::Object*) (global-handles.cc:197)
 by 0x8142B94: v8::internal::Malloced::operator new> >> (unsigned int)
(allocation.h:69)
 by 0x8265D53: v8::internal::Malloced::New(unsigned int)> >>
(allocation.cc:37)
 at 0x4005A88: malloc (vg_replace_malloc.c:207)



v8::internal::GlobalHandles::Create creates a node and there no way to
make is weak or destroy it by calling GlobalHandles::Destroy
Thanks

Vishnu

On Jan 24, 1:48 am, Patrick Johnson <[email protected]> wrote:
> On Fri, Jan 23, 2009 at 11:48 AM, Mike Belshe <[email protected]> wrote:
> > The GC is non deterministic.
> > I believe the Dispose will drop the weak reference for your object, but
> > doesn't guarantee that the GC runs right away.
>
> > In the debugging case, you could force a GC to verify this.  However,
> > forcing GC in production code is not supported ....
>
> > Do you need deterministic finalization?  If so, you'll need to do it on
> > your own - this is a feature not supported by javascript.
>
> > Mike
>
> > On Fri, Jan 23, 2009 at 9:14 AM, vishnu <[email protected]> wrote:
>
> >> Hi all,
>
> >> I am getting a leak while trying to use the V8 library with
> >> context::new -This is the output of valgrind .seems like the node
> >> allcoated neevr seems to get Destroyed and for each Context::new it
> >> goes on accumaualtaing
>
> >> I am calling context.Dispose and context.clear .but stil the leak is
> >> there.
> >> And also calling
>
> >> GlobalHandles::Destroy(h1.location()); is causing a seg fault since
> >> that node is still in use.
>
> >> can anyone please tell me how to get rid of this leak wihtout changing
> >> much of the class memebers of classes Bootstrapper:: and Genesis
>
> >> ==9384== 35,984 bytes in 154 blocks are still reachable in loss record
> >> 18 of 19
> >> ==9384==    at 0x4005A88: malloc (vg_replace_malloc.c:207)
> >> ==9384==    by 0x8265D53: v8::internal::Malloced::New(unsigned int)
> >> (allocation.cc:37)
> >> ==9384==    by 0x8142B94: v8::internal::Malloced::operator new
> >> (unsigned int) (allocation.h:69)
> >> ==9384==    by 0x815B1C4: v8::internal::GlobalHandles::Create
> >> (v8::internal::Object*) (global-handles.cc:197)
> >> ==9384==    by 0x8129C67: v8::internal::Genesis::CreateRoots
> >> (v8::Handle<v8::ObjectTemplate>,
> >> v8::internal::Handle<v8::internal::Object>) (bootstrapper.cc:463)
> >> ==9384==    by 0x812ED77: v8::internal::Genesis::Genesis
> >> (v8::internal::Handle<v8::internal::Object>,
> >> v8::Handle<v8::ObjectTemplate>, v8::ExtensionConfiguration*)
> >> (bootstrapper.cc:1454)
> >> ==9384==    by 0x812EE69: v8::internal::Bootstrapper::CreateEnvironment
> >> (v8::internal::Handle<v8::internal::Object>,
> >> v8::Handle<v8::ObjectTemplate>, v8::ExtensionConfiguration*)
> >> (bootstrapper.cc:346)
> >> ==9384==    by 0x8112A97: v8::Context::New
> >> (v8::ExtensionConfiguration*, v8::Handle<v8::ObjectTemplate>,
> >> v8::Handle<v8::Value>) (api.cc:2265)
> >> ==9384==    by 0x8106F9A: V8EcmaObject::V8EcmaObject(int, void**) (v8-
> >> script.h:54)
> >> ==9384==    by 0x8105718: __ccxml_initscript(ccxml_document_s*)
> >> (v8if.c:58)
> >> ==9384==    by 0x80F699E: _ccxml_initscript (ecmascript.c:64)
> >> ==9384==    by 0x400E751: ???
>
> >> Thanks a lot
>
> >> Vishnu- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to