This is useful for example in a hash table, or linked list implementation, you usually have "buckets," elements that act as container for every element in the structure. By preallocacting these buckets you can gain a nice performance increase (on my little hash implementation, i gained an average of 25% improvement). Its also useful when implementing scripting languages (VHLL's, which is why I wrote it), when your language has a base type (for example in PHP, its a "zval"), that is really created and destroyed quite often, avoiding malloc'ing and free'ing a few thousand times is quite nice.
Anyhow, the code is quite small, and available at:
http://www.bumblebury.com/csexp101.tgz
the relevant files are
memobj/memobj.[ch]
and you can see the difference by::
time ./test.memobj time ./test.normal
To implement it, I used a two dimensional array, that way you avoid fragmentation, and still have reasonable performance. I'll write up something a little more formal later..
FOAF updates: Trust rankings are now exported, making the data available to other users and websites. An external FOAF URI has been added, allowing users to link to an additional FOAF file.
Keep up with the latest Advogato features by reading the Advogato status blog.
If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!