caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* callback question
@ 2006-10-07 15:08 micha
  2006-10-07 15:16 ` [Caml-list] " Richard Jones
  0 siblings, 1 reply; 3+ messages in thread
From: micha @ 2006-10-07 15:08 UTC (permalink / raw)
  To: caml-list

I'm storing an ocaml object in a c++ class (the class calls methods of
the ocaml class). To do that I register the object as described for
callback functions in the manual and use it with caml_named_value.
It works perfect so it seems to be the right way. (?)
But does the gc ever remove the object (since it is registered as a
callback)?

In a class definition, is this the  correct way to get things cleaned
up:

class x = object
 val obj = native_pointer
 ...
 initializer
    Gc.finalise (fun _ -> delete native_pointer) self;
end;;


 Michael


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] callback question
  2006-10-07 15:08 callback question micha
@ 2006-10-07 15:16 ` Richard Jones
  2006-10-07 17:51   ` micha
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Jones @ 2006-10-07 15:16 UTC (permalink / raw)
  To: micha; +Cc: caml-list

On Sat, Oct 07, 2006 at 05:08:48PM +0200, micha wrote:
> I'm storing an ocaml object in a c++ class (the class calls methods of
> the ocaml class). To do that I register the object as described for
> callback functions in the manual and use it with caml_named_value.
> It works perfect so it seems to be the right way. (?)
> But does the gc ever remove the object (since it is registered as a
> callback)?

You don't need to post questions twice.

Why don't you call Gc.compact () and see if the object gets freed?

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Internet Marketing and AdWords courses - http://merjis.com/courses - NEW!
Merjis blog - http://blog.merjis.com - NEW!


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] callback question
  2006-10-07 15:16 ` [Caml-list] " Richard Jones
@ 2006-10-07 17:51   ` micha
  0 siblings, 0 replies; 3+ messages in thread
From: micha @ 2006-10-07 17:51 UTC (permalink / raw)
  To: caml-list

Am Sat, 7 Oct 2006 16:16:42 +0100
schrieb Richard Jones <rich@annexia.org>:

> You don't need to post questions twice.
> 
that was a mistake, I didn't saw my first post.

> Why don't you call Gc.compact () and see if the object gets freed?

simply because I didn't know that.

 Michael


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-10-07 17:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-07 15:08 callback question micha
2006-10-07 15:16 ` [Caml-list] " Richard Jones
2006-10-07 17:51   ` micha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).