Garbage collection

Sergei Trofimovich slyfox at inbox.ru
Mon Jan 4 21:15:27 UTC 2010


On Sun, 3 Jan 2010 13:25:35 +0100
Enrico Weigelt <weigelt at metux.de> wrote:

> Hi folks,
> 
> 
> I'm working on using garbage collection (boehm-gc) instead of
> explicit free()'s.
> 
> Perhaps you like to have a look at it.

free in sense of libc's free(3)? It's call count is close to zero.
Is mc a memory allocation intensive beast? glib allows to insert own plugs
for malloc/free:

glib/gmem.h:
void g_mem_set_vtable (GMemVTable * vtable);

struct _GMemVTable                                                                                                             
{
  gpointer (*malloc)      (gsize    n_bytes);
  gpointer (*realloc)     (gpointer mem, gsize n_bytes);
  void     (*free)        (gpointer mem);  /* optional; set to NULL if not used ! */
  gpointer (*calloc)      (gsize    n_blocks, gsize    n_block_bytes);
  gpointer (*try_malloc)  (gsize    n_bytes);
  gpointer (*try_realloc) (gpointer mem, gsize    n_bytes);
};

What heap object's lifetime  bothers you? There is also g_mem_chunk_* for
fixed sized objects suitable for dentries.

Would be nice to see the problem for solution.


-- 

  Sergei
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20100104/c1e99e45/attachment.asc>


More information about the mc-devel mailing list