From: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | Michael Meskes <meskes(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org |
Subject: | ecpg thead-safe memory management + cleanup |
Date: | 2007-09-28 06:00:54 |
Message-ID: | 20070928144641.FB87.ITAGAKI.TAKAHIRO@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 | Content-Type | Size |
---|---|---|
ecpg-memory-8.3.patch | application/octet-stream | 29.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2007-09-28 09:02:42 | Re: too many variants of relation_open |
Previous Message | Jaime Casanova | 2007-09-28 03:28:14 | too many variants of relation_open |