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: Michael Livshin
Subject: Re: scm_must_malloc() vs. malloc()
Date: 19 Mar 2001 19:48:01 +0200
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Crater Lake)

Rob Browning <address@hidden> writes:

> Dirk Herrmann <address@hidden> writes:
> 
> > (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 :-)
> 
> Hmm.  Also, I thought I'd seen docs that more suggested that you
> should use scm_must_malloc whenever you *really* needed memory, and if
> you didn't get it the app was hosed.  I don't recall seeing the added
> caveat above that it should only be used for memory that the caller's
> not going to free.  But I may be mistaken.  In any case, if I come
> across those docs again, I'll update them.

I'd think that the _intuition_ behind the name `scm_must_malloc' (and
probably the original motivation to introduce this function) says "try
harder", but the present mental patterns concerning its usage seem to
be somewhat different.

this is because there is some piggy-backing logic inside of
`scm_must_malloc', namely the malloc threshold logic.  since malloc
threshold only makes sense for memory that is likely to be freed by
GC, the name `scm_must_malloc' loses the last bits of its
intuitiveness.

it's probably a good idea to somehow separate the "try hard to malloc"
and "malloc as part of the Scheme data" ideas.

-- 
... it's just that in C++ and the like, you don't trust _anybody_,
and in CLOS you basically trust everybody.  the practical result
is that thieves and bums use C++ and nice people use CLOS.
                -- Erik Naggum




reply via email to

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