Dan Weber <[EMAIL PROTECTED]> said:
> Boehm Garbage collector is the most widely used.  Its portable and on 
> every distribution I can think of.  This is due to even gcc embeds the 
> boehm garbage collector in itself.  Anyway, this ought to kill some of 
> those memory flaws; let the garbage collector handle it.

Sounds interesting, though slightly distracting at this particular moment,
nevertheless, a good thing to look into over the course of 2.0. For 2.1 and
beyond, there's lots of talk about glib. I'm ambivalent, sort of a "too good
to be true" but glib really does have everything that we need, done right.

WRT garbage collection, glib, which provides some of this functionality and
also some more interestitng functionality. My favorite tool is the memory
pool, which glib provides with nesting features, too. The best situation for
this is nested loops, where each inner loop needs to allocate some data which
is used once by the loop outside of it. So...

pool_init(outer);
while(foo) {
   pool_init(inner);
   while(bar) {
       pool_alloc(innner, stuff);
       bar--;
   }
   if (strcmp(something, inner))
       pool_alloc(outer, junk));
   pool_free(inner);
}
pool_free(outer);

Here's another neat concept, it creates new memory frames and let's you free
the entire thing all at once when you're done with a section of code:

http://irccrew.org/~cras/security/data-stack.html


Aaron

--

Reply via email to