Re: [flame] [new proto allocation]

chorgain@orion.aye.net
Date: 02/17/97


best method to use and that's what I'm using is every time you add a room
or what ever, create a new proto with size of the original one + another
entry and while that is done of course it is locked, then
memmove((void) new_proto, (void) old_proto, sizeof(old_proto));
works very nicely for me =)



 On Mon, 17 Feb 1997, Sammy wrote:

> 
> On Mon, 17 Feb 1997, JTRhone wrote:
> 
> > How do the two most common OLCs out there (obuild and oasis) allocate new
> > slots in the proto lists and world list?  I can see two ways.  I see
> > realloc()ing the entire list every time something is tacked on, or I can
> > see preallocating a certain amount on bootup.  I use a combination of both
> > in my OLC, I preallocate a chunk (+200 slots to be precise), and when that
> > gets used up (usually after about 2 - 3 days uptime, normal building
> > activity) I then realloc a new list with 200 more slots.  This both cuts
> > down on lag (not realloc()ing everytime a new proto is created) and
> > removes the uptime limit on new protos.  If there is a better way, what is
> > it?
> 
> I like your method.  Obuild just allocates a big chunk at boot time, but
> never reallocates.  When I wrote it originally, that was the best I could
> do, and since then haven't had any requests to change it so it's low on my
> list.  The number of extra mob, object, and room slots are set in config.c
> so it can be easily tuned.
> 
> I'm a bit wary of realloc.  The man page (tiny little thing) seems to
> indicate that the data in the block you're reallocating may or may not be
> moved.  It seems like that could cause some problems with pointers to that
> data.  Do you update every relevant pointer, or is this simpler than it
> looks?
> 
> Sam
> 
> +-----------------------------------------------------------+
> | Ensure that you have read the CircleMUD Mailing List FAQ: |
> |   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
> |    Or send 'info circle' to majordomo@cspo.queensu.ca     |
> +-----------------------------------------------------------+
> 

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
|    Or send 'info circle' to majordomo@cspo.queensu.ca     |
+-----------------------------------------------------------+



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