guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do we trust the man on the GC trigger?


From: Marius Vollmer
Subject: Re: Do we trust the man on the GC trigger?
Date: 29 Aug 2001 22:21:00 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.102

Dirk Herrmann <address@hidden> writes:

> On 28 Aug 2001, Marius Vollmer wrote:
> 
> >         When you don't have an accurate value for SIZE, pass 0.  This
> >         is not encouraged however, as it will distort the statistics.
> 
> What kind of 'statistics' are you thinking of?

The kind now done for `malloc-stats'.  In a production version of
libguile, these statistics might not be kept.

> I basically see scm_malloc as a wrapper around malloc, which - if
> malloc returns NULL - calls the gc and tries malloc again.  In this
> case scm_free would be just for symmetry.

Yes, and with the statistics enabled, for debugging.

> One could think of storing some additional data in the header of each
> malloc'ed block - that's probably the reason for your WHAT argument.  
> But:  why would scm_free then have to provide the size argument?  This
> could be stored in such a header as well.

Good point!  I wasn't thinking of scm_malloc necessarily keeping a
header around, and thought that the caller could in most cases easily
pass a valid SIZE value.  But, when we only make use of WHAT and SIZE
during debugging, we could just as well make scm_malloc allocate an
extra header, with SIZE and WHAT in it.

> scm_gc_register, scm_gc_unregister ?

Hmm, these sound like they are for registering roots with the GC.  I
was thinking more of somebody showing part of the hand they have in a
poker game.

> Similar wrappers, btw., would make sense for other system resources
> like file descriptors etc.

Yes.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]