ecpg thead-safe memory management + cleanup - Mailing list pgsql-patches

From ITAGAKI Takahiro
Subject ecpg thead-safe memory management + cleanup
Date
Msg-id 20070928144641.FB87.ITAGAKI.TAKAHIRO@oss.ntt.co.jp
Whole thread Raw
In response to Various ecpg cleanup  (ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
Responses Re: ecpg thead-safe memory management + cleanup
List pgsql-patches
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.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center


Attachment

pgsql-patches by date:

Previous
From: ITAGAKI Takahiro
Date:
Subject: Various ecpg cleanup
Next
From: "Jaime Casanova"
Date:
Subject: too many variants of relation_open