Buffer Addon: Those silly release_buffer calls

From: Gary Barnett (gbarnett@POLARNET.COM)
Date: 05/06/98


The buffer system is all well and fine, I didn't have any difficulty
determining how it works or how to get it functional.

However, it has become time to add all the release_buffer calls and with
2798 get_buffer calls I find myself dreading the prospect. I cannot do them
a little at a time, as I can't place into production a mud that uses 180megs
of ram at startup before the buffers time out and it settles down to 10 megs
(which is a nice reduction from before I started adding the buffer system.)

A couple ideas I've been considering, in order of difficulty.

1) Write a program to read the source and put all the release_buffer calls
in for me.
   a) search for all get_buffer calls in the file
   b) with each get_buffer call, read the source until you get another void,
int or struct, acmd call (not prototype).
      1) if you find a return, either warn or add the release buffers there
too
   c) look backwards for the release_buffer call for that var
   d) insert the call if it doesn't exist
   e) goto b

2) Use a call to 'register' the buffers
    a) update register buffer to allow buffer requests w/o intervening code
to count as one entry in structure
    b) #define RETURN {release_my_buffers;return;}
    c) remove all buffers from the 'last' entry in a)

3) Store the function being processed in a local var for each function. Use
that to figure out what buffers are in use by the function. This would
require storing instance data in a static var for recursive routines.

#1 seems like a lot of work. any suggestions on a perl script to handle it?
Would be a good excuse to finally learn a bit of perl.
#2 would probably become a mess and redefining return seems wrong.
#3 would waste a lot of memory storing function names and the static int for
recursion would be easy to mess up.

Anyone got a better idea? :-)

--
-- Gary Barnett, MCNE    http://www.ptialaska.net/~gbarnett/
-- Mallory@AntaresMUD  telnet://antares.kaschynna.com:7000
--


     +------------------------------------------------------------+
     | 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