Hi, Has there ever been a plan to eventually include memory allocation primitives as part of the PTh library to minimize the frequency of calls to malloc()/free()?
The reason why I am wondering is that kernels will often cause a process to sleep for an undetermined amount of time if memory resources become sparce or if processes need to be swapped out when malloc() uses sbrk() or mmap() to enlarge the process heap. An alternate implementation could call the libc malloc()/free() internally but provide pth_malloc()/pth_free() (and possibly pth_realloc()) using a managed heap, which I beleive could probably enhance performance when many threads need to allocate memory. If such an interface was provided, it also would allow the caller to specify custom malloc()/free() replacements which should be used internally to manage the internal heap, it thus would be possible to even provide a custom pair which uses mmap() with MAP_ANON and mlock(), if it was necessary that the memory never be written to swap, etc. Because those functions would be called rarely, and to allocate relatively large blocks at once, it would work Another area where it would help is on systems which provide poor unefficient implementations in their libc (which aren't too rare). The pth library itself could use pth_malloc() where it currently uses malloc(), etc. Just ideas I thought I would share... Also, if I wrote such a module for pth, following the general programming style, and posted the diff (against the current CVS repository sources) would it have a chance to eventually be included, or would it be considered as useless bloat by the community (or the author)? The implementation would not enlarge the library much. Thanks, Matt ______________________________________________________________________ GNU Portable Threads (Pth) http://www.gnu.org/software/pth/ Development Site http://www.ossp.org/pkg/lib/pth/ Distribution Files ftp://ftp.gnu.org/gnu/pth/ Distribution Snapshots ftp://ftp.ossp.org/pkg/lib/pth/ User Support Mailing List [EMAIL PROTECTED] Automated List Manager (Majordomo) [EMAIL PROTECTED]