Here is a patch to get memory management to thread-safe.
The auto_allocs global variable is split into per-thread variables
and accessed separately in each thread.

This patch is including the previous cleanup patch I sent because
I found pthread_once() for Win32 has a bug; it was not thread-safe.
I move the initialization of the mutexes and the init-once functions
to the loading of libecpg (DllMain).

* Fix memory management in multi-thread programs.
  The regression test for it is put on thread/alloc.pgc .
* Release all prepared statements on disconnection to avoid memory leaks
  even if users forget to DEALLOCATE their statements before disconnection.
* Remove memset(0) from ECPGalloc() because calloc() has already done it.
* Add const to some global variables.
* More thread-safety for Win32. (pthread_mutex_lock and pthread_once)
* Add more pthread emulation codes for Win32 to reduce #ifdef WIN32.

ITAGAKI Takahiro
NTT Open Source Software Center

Attachment: ecpg-memory-8.3.patch
Description: Binary data

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to