Memchunks again




The following code segfaults. Do you have any idea why? The seqfault
seems to go away if SIZE is less than 65513. It also goes away if
G_ALLOC_ONLY is changed into G_ALLOC_AND_FREE.

#include <glib.h>

#define SIZE 65513

int
main ()
{
  GMemChunk *chunk;
  guint8 *t1, *t2;
  gint i;

  chunk = g_mem_chunk_create (guint8[SIZE], 4, G_ALLOC_ONLY);

  t1 = g_chunk_new (guint8, chunk);
  for (i=0; i<SIZE; i++)
    t1[i] = 'a'; 
  t2 = g_chunk_new (guint8, chunk);
}

-- 
Søren Sandmann



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]