This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Making GC aware of overall allocation?


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.

Are you sure you aren't already relying on Guile to free your heap?

> 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.

Then just use plain malloc - gc will take care of it eventually, just
not as often as it should. Or bump scm_mallocated (see gc.h).

> Remember that The Competition uses ref. counting and does not suffer
> from this problem. There are other issues with that approach of
> course, which is shy away from, but it is not like there is  not
> complexity enough already for the new and naive Guile programmer to
> instead consider the more simplistic competition.

GC is still simpler than refcounting - you listed the reasons already
(I'll add one you probably didn't hear of: Ever tried to use Purify
with refcounting?). But either you have to let GC know how much you
allocated or you have to call GC manually - there is no third
possibility. At least with GC you are allowed to slack and don't
bother - memory use will increase but won't explode to infinity.

-- 
How to eff the ineffable?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]