Subject: Re: Allocating on the stack and *only* on the stack
From: Erik Naggum <>
Date: 11 Dec 2000 18:45:45 +0000
Newsgroups: comp.lang.lisp
Message-ID: <>

* Fernando Rodríguez <spam...@must.die>
| How can I make *absolutelly* sure that lisp allocates memory on the
| stack?

  By calling a stack-allocating function yourself, presumably, but this
  is such an odd request that I doubt that you have asked for what you
  really need.

| It's a class that uses some windows resources that *must* be freed
| when leaving the function body where the class is used.

  What does "free" mean?  Objects on the stack are not _freed_ at all.
  The bytes of memory that made them up are still there until they are
  overwritten with something else.  If you have any references to that
  data when you leave the function, you're in _deep_ trouble.  So what I
  think you must mean is that you want to guarantee that there are no
  references to your data.  I can't see why that is a problem that does
  not have an obvious solution: Just the variables/slots/whatever that
  holds any such references to some other value, or nil, or whatever,
  and you no longer have any way of finding the data.

| In general, how can you free memory "manually", when you can't wait
| for the gc?

  Well, describe what it means to free it, and I'm sure it can be done.

  "When you are having a bad day and it seems like everybody is trying
   to piss you off, remember that it takes 42 muscles to produce a
   frown, but only 4 muscles to work the trigger of a good sniper rifle."
								-- Unknown