Re: buffer.c of buffer.patch

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 08/02/97


On Fri, 1 Aug 1997, Daniel W. Burke wrote:

>I like this system, because widly used, this appears to be a real memory
>saver..... however, if there is something like release_all_buffers()
>what would be the point to calling release_buffer() since the next call
>to get_buffer() reuses any available buffers?

release_all_buffers() is only called during game_loop(), thus it is not
available while the MUD is booting, except for a couple I threw in for
sanity's sake.  It is a good idea because you can:
a) reduce the number of calls to release_all_bufffers()
b) reduce the number of buffers created when ones could be reused

>Seems that it would actually be a time saver (although we're probably
>only talking minor times here, but anyways) to leave the unused buffers
>to "idle" out in 5 minutes in release_all_buffers().

All buffers are cleared for usage every pulse although it makes sense to
call it less.

The idle out is to prevent excess buffers that just 'hang out'.  You can
arbitrarily increase it or decrease it.

>Also, given this system, you could make strings longer then you'll need,
>and not have to worry about wasting memory....

Yes, but you also have to remember that if there is no buffer that big
already, one will have to be created, although it can be reused again.

>all in all, I like this, but I'm wondering if anyone has any comments
>about it?  the practicality of it, or if it's really all that great, etc...

It's a pain in the butt to write from scratch because of all the
conversions.  I believe with proper tuning of release_all_buffer() call
frequency and buffer timeout it could decrease stress on the system. (And
eliminate buffer overflow exploits as the buffers are malloc()'d, not
stacked.)

And if you comment out the debugging messages, you never have to worry
about release_buffer()...and if you do care, the code will tell you who
forgot to free it.

--
greerga@muohio.edu me@null.net | Genius may have its limitations, but stupidity
http://www.muohio.edu/~greerga | is not thus handicapped. -- 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/08/00 PST