[gclist] Boehm's GC and multi-threaded libraries
Dean Brettle
brettle@picard.jmb.bah.com
Wed, 22 Jan 1997 11:40:10 -0500
Hans Boehm wrote:
<stuff deleted>
> 2. Arrange that the collector is only invoked from the one active thread that
> might have pointers to garbage collected memory. It sounds to me like
> Dean's observation to avoid REDIRECT_MALLOC is close to sufficient in this
> case.
> You do have to be careful that you do not pass essential pointers to garbage
> collected data to the library, if the library expects the data to outlive
> the call. I would guess that's easy in this case.
<stuff deleted>
Thanks for the help.
I am still somewhat confused by the warning concerning passing essential
pointers to the library. Assuming:
1. for each call to the library, the threads created do not outlive the
call (i.e. there is only one thread when the call completes). For
ImageVision, I _think_ this is the case for all but the methods
beginning with q.
2. the GC is not called within the library (because I haven't done a
REDIRECT_MALLOC)
Why would there be a problem with passing pointers to GC'd memory into
the library, even if the library expects the data to outlive the call?
What is it about multi-threading that makes this a problem? Or, is the
problem due to the fact that we want to do _incremental_ GC?
It seems like, with the above assumptions, the GC shouldn't be able to
tell that the library is multi-threaded. Am I missing something, or was
your response based on different assumptions? If I am missing
something, is there a simple example or reference that would clear
things up?
Thanks again,
--Dean