[Gc] Boehm GC interaction with other libraries

eric lindvall eric@5stops.com
Wed, 26 Nov 2003 15:03:26 -0800

I have a few questions about how code that uses the Boehm GC interacts
with libraries that were not compiled against the Boehm GC

I am seeing some odd behaviour when using Platform Invoke (P/Invoke) in
Mono to invoke native libraries from Mono. From what I can see, it seems
like there is some sort of memory corruption going on.

The native library makes use of:
 - malloc(), free()
 - pthread_create()
 - pthread_cond_init(), pthread_cond_signal(), pthread_cond_wait()
 - sem_init(), sem_wait(), sem_post()
 - msgsnd(), msgrcv()

The questions I have are:

1. Is memory that I allocate with malloc() in libraries that were not
compiled against boehm seen by the garbage collector? (will it ever be
collected out from under me?)

2. Will boehm just "ignore" any threads that were created by
a version of pthread_create() that was not wrapped by boehm?

3. Will anything bad happen if the libraries that I invoke use