guile-devel
[Top][All Lists]
Advanced

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

Re: scm_must_malloc() vs. malloc()


From: Dirk Herrmann
Subject: Re: scm_must_malloc() vs. malloc()
Date: Sun, 18 Mar 2001 22:31:06 +0100 (MET)

On 17 Mar 2001, Gary Houston wrote:

> OK, on the basis of your explanation (thanks!) I've changed them,
> together with some of the allocation in ports.c, but I've got a query
> below.
[...]
> This doesn't seem like the whole story though: if malloc fails due to
> lack of memory, there's a chance that running the garbage collector
> would free some up.  So basic malloc/realloc could be improved on even
> for memory not under the control of gc.

Yes, you're right.  It would be good if we had a scm_alloc function which
tries to get some memory and (in case of failure) calls the gc to free
some.  Maybe it is even possible to install some handler to capture memory
allocation failures that happen with plain malloc.  In a similary way,
failed attempts to obtain other system ressources (like file descriptors)
might be handled:  If all file descriptors are in use, chances are that
garbage collection would free some.

(Maybe we should also try to find better names for scm_must_malloc and
friends.  The current names don't express very clearly what they are to be
used for :-)

Best regards,
Dirk Herrmann




reply via email to

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