Hi Aziz,
I don't know if this would help, but you might look at how OCaml's FFI
deals with registering new data types. The garbage collector takes
certain parameters that bias how often it runs the garbage collector.
http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html#toc136
(Look specifically at section 18.9.2)
Ron
On Oct 2, 2009, at 2:09 AM, Abdulaziz Ghuloum wrote:
On Oct 1, 2009, at 8:31 PM, Andreas Rottmann wrote:
Given the above, you have two options to make the reclamation happen
automatically: Either place a call to `collect-blas-vectors' into
`make-blas-vectors', or register `collect-blas-vectors' with the GC,
which is a recently-added feature[0]. You can read more about
guardians
in the paper "Guardians in a Generation-Based Garbage Collector", by
Dybvig et al. [1].
The only little problem that I see is that making many BLAS vectors
quickly could potentially run out of memory before the GC triggers.
(because a BLAS vector of N bytes will only use fixed few bytes of
Scheme data, and it will take lots of these to cause a GC) I don't
have a clean solution to this problem. Any ideas?
Aziz,,,