Re: Buffer Addon: Those silly release_buffer calls

From: George (greerga@CIRCLEMUD.ORG)
Date: 05/06/98


On Wed, 6 May 1998, James Turner wrote:

>There is an option for glibc based systems -- alloca.  It's like
>malloc except when used, the system will automatically free the memory
>allocated.  So...

Unfortunately, we cannot check if the buffer was overflowed then since we
want to know when the buffer is done being used.  This method would be the
fastest, but at this point, you might as well keep the char[] method.

>You don't have to worry about free()ing the string because the alloca
>takes care of that when the function that uses it returns.

The 'release_all_buffers()' function called occaisonally will take care of
any buffers which are left unreleased.  None of the buffers are actually
free()'d until they are unused for 5 minutes.

--
George Greer, greerga@circlemud.org | Genius may have its limitations, but
http://patches.van.ml.org/          | stupidity is not thus handicapped.
http://www.van.ml.org/CircleMUD/    |                  -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST