add batch-mode script
[IRC.git] / Robust / src / Runtime / mem.c
index d33a6752eec43ff5aed5001f18f0c585cf5790a7..80caa39228eeeab4645cdfd751faae86188eadcd 100644 (file)
 #include "multicoremem.h"
 #include "multicoregarbage.h"
 #endif
+#ifdef PMC_GC
+#include "multicoregc.h"
+#include "pmc_garbage.h"
+#endif
 
 #if defined(MULTICORE_GC)||defined(PMC_GC)
 extern volatile bool gcflag;
@@ -24,14 +28,14 @@ void * mycalloc_share(struct garbagelist * stackptr, int size) {
   int hasgc = 0;
   int loopcount = 0;
 
-  while(loopcount<10000) {
+  while(true) {
     p = BAMBOO_SHARE_MEM_CALLOC(isize); // calloc(m, isize);
 
     if(p != NULL) 
       return p;
     
     // no more global shared memory
-    if(hasgc < 5) {
+    if(hasgc < 30) {
       // start gc
       if(gcflag) {
        gc(stackptr);
@@ -42,8 +46,11 @@ void * mycalloc_share(struct garbagelist * stackptr, int size) {
       printf("Did %u collections without getting memory\n", hasgc);
       BAMBOO_EXIT();
     }
+    loopcount++;
+    if (loopcount>10000000)
+      tprintf("Loopcount in mycalloc_share hit %u\n",loopcount);
   }
-  tprintf("Loopcount hit 10000\n");
+
   BAMBOO_EXIT();
   return NULL;
 }