Is it safe to call pfree() from multiple threads?
My Java backend will need to utilize finalizers. Objects like a saved
execution plan that has been "forgotten" must be released when the wrapping
Java object is finalized to avoid memory leaks. The finalizer is called from
the garbage collector which in turn might run in a separate thread. I have
two choices:
1. Let finalizers put pfree() candiates on a "death row" and let each call
from SQL into my call manager pfree() the candidates found there. All "death
row" management is of course subject to a mutex.
2. Let the finalizer call pfree directly and trust that it is thread safe.
Advice is greatly appreciated.
- thomas