This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Making GC aware of overall allocation?
Miroslav Silovic writes:
MS> Lars Arvestad <arve@nada.kth.se> writes:
>> In my case, I want to eventually distribute a C library to be linked
>> in any application and do not want any dependencies on Guile.
MS> Are you sure you aren't already relying on Guile to free your heap?
Most definately! I have written a library, with small test program,
that is selfcontained. In addition, I have glue to put the library
under Guile-control. I do not mind putting whatever Guile code in the
glue, but want to avoid any more code in my library.
>> I could provide my own version of scm_must_malloc which would
>> essentially be an alias for malloc(), but this will in the end
>> evolve bugs with other programmers not honoring the Guile legacy for
>> instance.
MS> Then just use plain malloc - gc will take care of it eventually, just
MS> not as often as it should. Or bump scm_mallocated (see gc.h).
That is what I have done, but since my datastructures are very large
(depends on input (which depends on my test setup), but a typical size
is 20 MB) and I run hundreds of tests, each generating three
datastructures, "eventually" is not good enough. I run out of swap
space before Guile decides to do a GC.
Lars
--
Lars Arvestad Dept. of Numerical Analysis and Computing Science
Royal Institute of Technology (KTH), Stockholm, Sweden