Question regarding pfree and thread safety.

Поиск
Список
Период
Сортировка
От Thomas Hallgren
Тема Question regarding pfree and thread safety.
Дата
Msg-id bu84oo$f42$1@news.hub.org
обсуждение исходный текст
Ответы Re: Question regarding pfree and thread safety.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: [GENERAL] Bug and/or feature? Complex data types in
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Postgres v.7.3.4 - Performance tuning