Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] register_global_root, malloc, etc.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Chris Hecker <checker@d...>
Subject: Re: [Caml-list] register_global_root, malloc, etc.

>I can't understand who will delete `foo *', allocated via `foo *p = new
>foo'?

free_foo unregisters the roots pointing inside foo, and then deletes foo.  The GC will deallocate the abstract object itself.

> As I understood from the manual, Custom_tag is the only way to
>assign free_foo with the resulting Caml object.

Custom means the object gets a finalization call from the gc.  Abstract means there's no finalization.  I should be using Custom so my foo doesn't leak.

Chris


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr