From: bdemsky Date: Thu, 30 Jun 2011 20:51:30 +0000 (+0000) Subject: changes...make it actually do the gc's... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9e7cb7190836acdbc4abadf5b9d44a9233e841ec;p=IRC.git changes...make it actually do the gc's... --- diff --git a/Robust/src/Runtime/mem.c b/Robust/src/Runtime/mem.c index 1e2e1a5f..7490bb6f 100644 --- a/Robust/src/Runtime/mem.c +++ b/Robust/src/Runtime/mem.c @@ -15,31 +15,31 @@ void * mycalloc_share(struct garbagelist * stackptr, int size) { void * p = NULL; int isize = ((size-1)&(~(ALIGNMENTSIZE-1)))+ALIGNMENTSIZE; int hasgc = 0; + int loopcount = 0; - while(true) { - if(gcflag) { - gc(stackptr); - } + while(loopcount<10000) { p = BAMBOO_SHARE_MEM_CALLOC(isize); // calloc(m, isize); - if(p == NULL) { - // no more global shared memory - if(hasgc < 5) { - // start gc - if(gcflag) { - gc(stackptr); - } + if(p != NULL) + return p; + + // no more global shared memory + if(hasgc < 5) { + // start gc + if(gcflag) { + gc(stackptr); hasgc++; - } else { - // no more global shared memory - BAMBOO_EXIT(); } - } else - break; + } else { + // no more global shared memory + printf("Did %u collections without getting memory\n", hasgc); + BAMBOO_EXIT(); + } } - - return p; + tprint("Loopcount hit 10000\n"); + BAMBOO_EXIT(); } + #else void * mycalloc_share(int size) { int isize = ((size-1)&(~(BAMBOO_CACHE_LINE_MASK)))+(BAMBOO_CACHE_LINE_SIZE);