flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.0 out now! Get yours from http://caml.inria.fr/ocaml/release.html
mbac has quit [Remote closed the connection]
fschwidom has quit [Remote closed the connection]
jdev has quit [Read error: 104 (Connection reset by peer)]
smimram has quit [Read error: 110 (Connection timed out)]
jdev has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
noon has quit ["Ex-Chat"]
malc_ has joined #ocaml
Smerdyakov has quit ["Leaving"]
mfp has quit [Read error: 110 (Connection timed out)]
struktured_ has joined #ocaml
malc_ has quit ["leaving"]
struktured has quit [Read error: 110 (Connection timed out)]
jeddhaberstro has quit []
mishok13 has joined #ocaml
_zack has joined #ocaml
jeremiah has quit [Read error: 104 (Connection reset by peer)]
Axioplase has quit ["Lost terminal"]
jeremiah has joined #ocaml
mfp has joined #ocaml
smimou has joined #ocaml
<mrvn> anyone awake?
jeremiah has quit [Read error: 104 (Connection reset by peer)]
petchema_ has joined #ocaml
jeremiah has joined #ocaml
fschwidom has joined #ocaml
petchema has quit [Read error: 113 (No route to host)]
fschwidom has quit [Connection timed out]
_zack has quit ["Leaving."]
jlouis has quit [Remote closed the connection]
struktured__ has joined #ocaml
struktured_ has quit [Read error: 110 (Connection timed out)]
barismetin has quit [Remote closed the connection]
fschwidom has joined #ocaml
itewsh has joined #ocaml
<tsuyoshi> mrvn: you only need to register the values you're protecting
<tsuyoshi> like if you store a function in some c struct, you only need to register the function really, and not the c struct
<mrvn> Yes.
<mrvn> Should I regider/deregister the closures every time I get one or isn't it better to keep a registered array of values and store the closures there whenever I have one?
<mrvn> i.e. modify the array
<mrvn> Actually forget that.
<mrvn> The closure is copied into a struct iocb and passed to the kernel. Later then the kernel returns it. SO I have no way to tell the Gc where the closure will be in memory. So I do have to keep a copy in a fixed location and register that.
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
<mrvn> Something like this: CAMLprim void read(value fn) { CAMLparam1(fn); value *p = malloc(sizeof(value)); *p = fn; caml_register_global_root(p); struct iocb io; io.data = p; do_io(&io); CAMLreturn0; } CAMLprim void callback(struct iocb *io) { caml_callback(*(io->data), Val_unit); caml_remove_global_root(io->data); }
<mrvn> +free(io->data);
<tsuyoshi> the kernel returns it?
<mrvn> The libaio returns a struct io_event { void *data; ... }
<mrvn> I have no control over where the "void *data" gets stored or copied around between when I give it to libaio (and thus the kernel) and when it comes back.
<mrvn> The io_event also contains the struct iocb *io. I guess I could just use that. Not sure why the void *data is copyied explicity into the io_event. Seems wastefull.
<mrvn> Then I would use caml_register_global_root(&io->data);, right?
<mrvn> it segfaults. :(
<mrvn> doh, I forgot to CAMLreturn(ml_str). I had a dummy CAMLreturn(Val_int(0)) there.
<mrvn> Now I need one more custom block for the aio context and it should be working.
<mrvn> Only problem I've got left is that at the end of the program the GC doesn't run so *_finalized() may never be called. How do I makes sure that it does?
ikaros has joined #ocaml
Smerdyakov has joined #ocaml
<tsuyoshi> atexit() will work unless the process aborts
<mrvn> 'at_exit Gc.full_major' it is.
<mrvn> Or should I keep track of all custom blocks allocated and manually free them?
<mrvn> Are custom blocks moved during compaction?
Stefan_vK has joined #ocaml
ikaros has quit [Remote closed the connection]
Stefan_vK1 has quit [Read error: 110 (Connection timed out)]
alexyk has joined #ocaml
vixey has joined #ocaml
Kerris7 has joined #ocaml
mishok13 has quit ["Stopping IRC chat... [OK]"]
fschwidom has quit [Remote closed the connection]
jeddhaberstro has joined #ocaml
jeddhaberstro_ has joined #ocaml
jeddhaberstro__ has joined #ocaml
jeddhaberstro___ has joined #ocaml
jeddhaberstro___ has quit [Read error: 145 (Connection timed out)]
jeddhaberstro___ has joined #ocaml
jeddhaberstro has quit [Read error: 110 (Connection timed out)]
jeddhaberstro__ has quit [Connection timed out]
jeddhaberstro_ has quit [Read error: 110 (Connection timed out)]
jeddhaberstro has joined #ocaml
jeddhaberstro___ has quit [Read error: 60 (Operation timed out)]
Guest11238 is now known as purple_
jeddhaberstro has quit []
marmotine has joined #ocaml
Kerris7 has quit [Read error: 60 (Operation timed out)]
Kerris7 has joined #ocaml
jeddhaberstro has joined #ocaml
Kerris7 has quit []
Kerris7 has joined #ocaml
Kerris7 has quit [Client Quit]
marmotine has quit [Read error: 60 (Operation timed out)]
marmotine has joined #ocaml
alexyk has quit []
ofaurax has joined #ocaml
caligula__ has quit [Remote closed the connection]
caligula has joined #ocaml
Kerris7 has joined #ocaml
ofaurax has quit [Remote closed the connection]
<gildor> mrvn: just see your bug on debian-ocaml
<gildor> mrvn: I am really not sure this is bug
<gildor> mrvn: in OCaml case, finalizer is about memory, not tracking panding aio
<gildor> just as close_out
haelix has quit [Read error: 104 (Connection reset by peer)]
haelix has joined #ocaml
fschwidom has joined #ocaml
marmotine has quit [Read error: 113 (No route to host)]
Smerdyakov has quit ["Leaving"]
jeremiah has quit [Read error: 104 (Connection reset by peer)]
Mr_Awesome has quit ["aunt jemima is the devil!"]
jeremiah has joined #ocaml
ppsmimou has quit [Read error: 110 (Connection timed out)]
shortc|desk has quit ["Probably rebooting."]
struktured__ is now known as struktured
jlouis has joined #ocaml
jlouis has quit [Client Quit]
jlouis has joined #ocaml
shortc|desk has joined #ocaml
marmotine has joined #ocaml
jeddhaberstro_ has joined #ocaml
_zack has joined #ocaml
_zack has quit [Remote closed the connection]
_zack has joined #ocaml
jeddhaberstro__ has joined #ocaml
jeddhaberstro has quit [Read error: 110 (Connection timed out)]
jeddhaberstro__ has quit [Read error: 60 (Operation timed out)]
jeddhaberstro_ has quit [Read error: 110 (Connection timed out)]
jeddhaberstro has joined #ocaml
_zack has quit ["Leaving."]
barismetin has joined #ocaml
jeddhaberstro_ has joined #ocaml
jeddhaberstro has quit [Read error: 145 (Connection timed out)]
Kerris7 has quit ["Who is Candlejack? Is he going to c"]
itewsh has quit ["KTHXBYE"]
marmotine has quit ["mv marmotine Laurie"]
barismetin has quit [Remote closed the connection]
vixey has quit ["There exists an infinite set!"]