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 | +-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST