Commit Graph

73 Commits

Author SHA1 Message Date
Hallvard Furuseth
624642ba83 Fix sl_malloc valgrind support. 2012-01-24 01:45:51 +01:00
Kurt Zeilenga
2bbf9804b9 Happy New Year! 2012-01-01 07:10:53 -08:00
Howard Chu
472c0d7877 Add Valgrind mempool support.
Compile with -DUSE_VALGRIND. It will attempt to keep Valgrind
informed of our memory allocations. Frees are trickier since they
may be deferred indefinitely.
2011-09-08 21:39:45 -07:00
Howard Chu
b1f26a8b17 Fix NO_THREADS typo 2011-06-22 20:03:24 -07:00
Kurt Zeilenga
966cef8c9a Happy New Year 2011-01-05 00:42:37 +00:00
Quanah Gibson-Mount
fa428ed259 Agreed upon log messages for sl_malloc/zn_malloc when falling back 2010-04-19 22:55:51 +00:00
Hallvard Furuseth
d58f4ff849 Gentler message when falling back to ch_malloc 2010-01-15 18:53:13 +00:00
Hallvard Furuseth
644506db6b ITS#6437: Fix pool version misalignment: It aligned heads, not returned blocks 2010-01-05 23:31:14 +00:00
Hallvard Furuseth
705bd5bf40 ITS#6437, move structs slab_object and slab_heap from slap.h to sl_malloc.c 2010-01-05 23:14:14 +00:00
Hallvard Furuseth
1af33a46c9 ITS#6437, save space: Do not allocate the tail, except if size==0.
Store a tail only in freed blocks.  (Alignment ensures there will
be room.)  Put the freed mark in next block's head.
2010-01-05 22:11:24 +00:00
Hallvard Furuseth
d515f24255 ITS#6437 cleanup (noop patch): Join SLAP_NO_SL_MALLOC code with identical
ctx==NULL code.  Add enum No_sl_malloc to avoid #ifdef SLAP_NO_SL_MALLOC.
2010-01-05 19:40:28 +00:00
Hallvard Furuseth
5d883c044a ITS#6437, follow up previous fixes:
Ensure Align >= sizeof(ber_len_t), to clarify the code's requirements.
Rearrange a slap_sl_malloc() branch to factor out ch_malloc fallbacks.
Fix range check (ptr+size >= endptr) -> (size >= endptr-ptr).  Fix debug msg.
2010-01-05 19:25:28 +00:00
Hallvard Furuseth
40017c3874 Add comments 2010-01-02 23:42:31 +00:00
Hallvard Furuseth
4e66da4ec1 ITS#6437, slap_sl_calloc():
Check count*size overflow. Omit slap_sl_malloc failure check, it cannot fail.
2010-01-02 22:53:22 +00:00
Hallvard Furuseth
423c13a6d6 ITS#6437, failure/fallback/debug handling:
slap_sl_malloc could return failure. Exit instead, like the rest of sl_malloc.
Since we increase size, reduce it before Debug() and/or fallback to ch_malloc.
Debug() before exit() on failure.  Tweak debug formats and a comment.
2010-01-02 22:41:41 +00:00
Hallvard Furuseth
46b99131cb ITS#6437 cleanup (noop change):
Move thread/nothread code to macros SET_MEMCTX()/GET_MEMCTX().
Rename some thread/memory contexts 'ctx' to thrctx/memctx to avoid confusion.
2010-01-02 22:03:48 +00:00
Hallvard Furuseth
cc58227437 ITS#6437, fixes for stack implementation of slap_sl_realloc():
Preserve 2*int alignment on hosts where sizeof(int) == sizeof(ber_len_t).
If realloc of last block falls back to ch_malloc, free last block properly.
Fix range check (ptr + size < endptr) --> (size < endptr - ptr).
2010-01-02 21:39:46 +00:00
Hallvard Furuseth
5b164ba74c ITS#6437: Fix alignment after slap_sl_realloc().
Also use -Align instead of ~pad: Valid also for non-twos complement.
2010-01-02 21:05:11 +00:00
Hallvard Furuseth
4c36193a5c ITS#6437 cleanup (noop change): Simplify slap_sl_free() code reclaiming space 2010-01-02 18:42:33 +00:00
Hallvard Furuseth
d8d00ec45c ITS#6437 cleanup (noop change): Compute pad,order_start at compile time 2010-01-02 18:27:51 +00:00
Hallvard Furuseth
062021e731 ITS#6437, slap_sl_mem_create():
Bugfix: Switching implementation stack<->pool on an old context could
        crash or leak, it ran the wrong implementation's cleanup code.
Cleanup:  Factor out identical stack/pool code.  Call
          slap_sl_mem_destroy(NULL,) instead of copying its pool code.
API change: slap_sl_mem_destroy(key=NULL,) gets a new meaning.  Does
            not affect current OpenLDAP code, it never passed NULL.
2010-01-02 18:05:56 +00:00
Howard Chu
68ab1a2272 Cleanup 2009-11-15 10:34:10 +00:00
Howard Chu
c9d86af0ba Fix 1.49 sl_realloc 2009-11-15 03:02:09 +00:00
Howard Chu
1eebd22151 Add a note about sl_malloc stack-based behavior 2009-11-14 23:25:14 +00:00
Howard Chu
3fbbd8ea3f Mark freed regions so they can be reclaimed 2009-11-14 23:20:44 +00:00
Howard Chu
b0e50c6a7d ITS#6054 assert/exit on failed allocs 2009-04-11 03:40:12 +00:00
Howard Chu
5152ea19a3 ITS#6005 realloc should be ch_realloc 2009-03-09 00:48:44 +00:00
Kurt Zeilenga
4af9eb9715 Update copyright notices 2009-01-22 00:40:04 +00:00
Hallvard Furuseth
cd63a0c43b Warning cleanup: function ptr <=> void* at ldap_pvt_thread_pool_<set/get>key() 2008-01-11 06:07:43 +00:00
Kurt Zeilenga
c890c96d13 Happy New Year (belated) 2008-01-08 00:19:56 +00:00
Pierangelo Masarati
30f401c628 rename ldap_pvt_thread_pool_setkey_x() to ldap_pvt_thread_pool_setkey() (as part of ITS#5309) 2008-01-07 21:35:03 +00:00
Hallvard Furuseth
8eda2e301f Fix SLAP_NO_SL_MALLOC (ber_malloc_x -> ber_memalloc_x) for ITS#4990. 2007-07-04 22:49:34 +00:00
Howard Chu
e28627f1e2 Added "slapd" rewrite map handler, connection_fake_init2 to use existing
tmpmemctx without reinitializing
2007-02-14 08:51:47 +00:00
Kurt Zeilenga
da6d9eb046 happy new year 2007-01-02 20:00:42 +00:00
Pierangelo Masarati
b03d8abcde don't leak if realloc fails (ITS#4477) 2006-04-06 19:13:41 +00:00
Pierangelo Masarati
c6ab0790d1 don't leak if realloc fails (ITS#4477); s/new/newptr/ 2006-04-06 19:07:48 +00:00
Howard Chu
8cbd5ecc13 Cleanup 2006-03-31 10:45:23 +00:00
Kurt Zeilenga
acbb5cf689 Happy new year! 2006-01-03 23:11:52 +00:00
Pierangelo Masarati
af23be3675 silence warnings... 2005-11-14 21:47:17 +00:00
Pierangelo Masarati
1b11741a30 mostly revert previous commit 2005-07-20 19:26:46 +00:00
Pierangelo Masarati
c789d494c4 allow to unregister (and free) memory handling functions 2005-07-20 19:07:04 +00:00
Hallvard Furuseth
81ecb0b153 assert expects int. (int)<nonnull ptr/long> can be 0. Use assert(arg!=0/NULL). 2005-07-18 06:22:33 +00:00
Hallvard Furuseth
885c73d02f struct slab_heap *sh was accessed through the wrong type 2005-07-14 21:57:25 +00:00
Howard Chu
5d2ba11ad9 ITS#3847 silence warnings 2005-07-11 12:11:15 +00:00
Hallvard Furuseth
8a696d21b2 Format fixes (%d<->%lu etc) 2005-07-04 05:29:12 +00:00
Howard Chu
43cd22a639 Fix ITS#3695 preserve stack alignment in slap_sl_realloc 2005-04-30 01:15:10 +00:00
Howard Chu
4c65aa9c44 Make sl_context just return NULL in tool mode, we have no threads here 2005-01-19 21:42:04 +00:00
Pierangelo Masarati
7f8634e8fc silence (a couple of) warnings 2005-01-14 11:50:24 +00:00
Kurt Zeilenga
dc0eacd40b Happy New Year! 2005-01-01 20:49:32 +00:00
Jong Hyuk Choi
4984e157b1 misc cleanup 2004-12-08 08:12:15 +00:00