Re: gethostname example: trying to avoid superfluous alloc+free

Kevin Rosenberg <kevin-HJRc7zDS/[email protected]> Thu, 21 Mar 2002 06:49:38 -0700 (MST)
Newsgroups gmane.lisp.uffi.general
Message-ID <[email protected]>
> I would like to see this approach also, and not just with strings. 
> For simple types, MCL does not even provide an alloc method (I have a 
> work-around using non-exported MCL functions). The approach (which 
> the docs say is highly optimized compared to alloc+free) look 
> something like:
> 
> (with-allocation ((my-long :long) (my-string :string 64)
>   ...forms...
> 
> Lispworks also has something like this (with-dynamic-foreign-objects).

Yes, I could add a (with-foreign-object) macro that can be designed to use
static or stack allocation depending upon how well each performs on
various platforms.

Kevin