[Gc] (more) Problems on mac

Stephane Epardaud Stephane.Epardaud at sophia.inria.fr
Wed Jul 6 07:51:21 PDT 2005


Hello,

I'm still trying to compile the GC7.a3 under MacOSX with pthread support.
After much problems with push_regs, getcontext and all, I came to the conclusion
that (as indicated by the #error macro in mach_dep.c) I needed to have
HAVE_ASM_PUSH_REGS undef'ed if THREADS and DARWIN were defined.
This made sure we were not using GC_push_regs, but then since UNIX_LIKE was
defined, in GC_with_callee_saves_pushed (mach_dep.c) I got the getcontext()
call, which is not implemented/defined in MacOSX, on the other hand,
HAVE_BUILTIN_UNWIND_INIT was, so I managed to get that one.
Now I have all that, and if I try this simple program:

#include <gc.h>
#include <stdio.h>


int main(int argc, char **argv){
  GC_init();
  while(1){
    printf("mallocing\n");
    GC_malloc(1024*1024);
  }
  return 0;
}

The size of my program running keeps on growing. This is only if configured with
--enable-threads=pthreads, if not then the program's memory consumption doesn't
grow. Is this normal ?

PS: to understand the changes I'm talking about, here's my mach_dep.c patch. If
I manage to get the GC to run correctly on MacOSX, I'll send more patches that I
needed to make it compile.

varuna separdau 16:50 ~/src $ diff -wu gc7.0alpha3-mint/mach_dep.c
gc7.0alpha3-nolurc/mach_dep.c
--- gc7.0alpha3-mint/mach_dep.c 2005-02-24 02:13:08.000000000 +0100
+++ gc7.0alpha3-nolurc/mach_dep.c       2005-07-06 15:31:27.183086304 +0200
@@ -75,6 +75,10 @@

 #undef HAVE_PUSH_REGS

+#if defined(DARWIN) && defined(THREADS)
+# undef USE_ASM_PUSH_REGS
+#endif
+
 #if defined(USE_ASM_PUSH_REGS)
 #  define HAVE_PUSH_REGS
 #else  /* No asm implementation */
@@ -210,7 +214,7 @@

 #   if defined(HAVE_PUSH_REGS)
       GC_push_regs();
-#   elif defined(UNIX_LIKE)
+#   elif defined(UNIX_LIKE) && !defined(DARWIN)
       ucontext_t ctxt;
       getcontext(&ctxt);
       context = &ctxt;


More information about the Gc mailing list