diff options
author | Matthias Huetsch [mhu] <matthias.huetsch@oracle.com> | 2011-01-31 13:34:47 +0100 |
---|---|---|
committer | Matthias Huetsch [mhu] <matthias.huetsch@oracle.com> | 2011-01-31 13:34:47 +0100 |
commit | 7fb5f183e6c67e58c382d1a1c44005a0541dc421 (patch) | |
tree | c5015b26344d21cd5b9828e84ab68a51cbc4c0df /sal/rtl | |
parent | 3859e8f28b464409015d8a2a3c6facb1d56b7632 (diff) |
#i115784# sal/rtl/alloc: improved support for valgrind(memcheck).
Diffstat (limited to 'sal/rtl')
-rw-r--r-- | sal/rtl/source/alloc_arena.c | 3 | ||||
-rw-r--r-- | sal/rtl/source/alloc_cache.c | 8 | ||||
-rw-r--r-- | sal/rtl/source/alloc_global.c | 2 | ||||
-rw-r--r-- | sal/rtl/source/alloc_impl.h | 3 |
4 files changed, 10 insertions, 6 deletions
diff --git a/sal/rtl/source/alloc_arena.c b/sal/rtl/source/alloc_arena.c index ec516f3573ac..6b57df355cad 100644 --- a/sal/rtl/source/alloc_arena.c +++ b/sal/rtl/source/alloc_arena.c @@ -1063,6 +1063,7 @@ SAL_CALL rtl_arena_alloc ( rtl_arena_hash_insert (arena, segment); + /* DEBUG ONLY: mark allocated, undefined */ OSL_DEBUG_ONLY(memset((void*)(segment->m_addr), 0x77777777, segment->m_size)); VALGRIND_MEMPOOL_ALLOC(arena, segment->m_addr, segment->m_size); @@ -1111,7 +1112,7 @@ SAL_CALL rtl_arena_free ( /* DEBUG ONLY: mark unallocated, undefined */ VALGRIND_MEMPOOL_FREE(arena, segment->m_addr); - VALGRIND_MAKE_MEM_UNDEFINED(segment->m_addr, segment->m_size); + /* OSL_DEBUG_ONLY() */ VALGRIND_MAKE_MEM_UNDEFINED(segment->m_addr, segment->m_size); OSL_DEBUG_ONLY(memset((void*)(segment->m_addr), 0x33333333, segment->m_size)); /* coalesce w/ adjacent free segment(s) */ diff --git a/sal/rtl/source/alloc_cache.c b/sal/rtl/source/alloc_cache.c index 563e777873d6..f4d34bfdb437 100644 --- a/sal/rtl/source/alloc_cache.c +++ b/sal/rtl/source/alloc_cache.c @@ -508,7 +508,7 @@ rtl_cache_slab_alloc ( else addr = bufctl; - /* DEBUG ONLY: mark undefined, allocated */ + /* DEBUG ONLY: mark allocated, undefined */ OSL_DEBUG_ONLY(memset(addr, 0x77777777, cache->m_type_size)); VALGRIND_MEMPOOL_ALLOC(cache, addr, cache->m_type_size); } @@ -535,7 +535,7 @@ rtl_cache_slab_free ( /* DEBUG ONLY: mark unallocated, undefined */ VALGRIND_MEMPOOL_FREE(cache, addr); - VALGRIND_MAKE_MEM_UNDEFINED(addr, cache->m_type_size); + /* OSL_DEBUG_ONLY() */ VALGRIND_MAKE_MEM_UNDEFINED(addr, cache->m_type_size); OSL_DEBUG_ONLY(memset(addr, 0x33333333, cache->m_type_size)); /* determine slab from addr */ @@ -644,11 +644,11 @@ rtl_cache_magazine_clear ( void * obj = mag->m_objects[mag->m_mag_used - 1]; mag->m_objects[mag->m_mag_used - 1] = 0; - /* mark cached object allocated, undefined */ + /* DEBUG ONLY: mark cached object allocated, undefined */ VALGRIND_MEMPOOL_ALLOC(cache, obj, cache->m_type_size); if (cache->m_destructor != 0) { - /* keep constructed object defined */ + /* DEBUG ONLY: keep constructed object defined */ VALGRIND_MAKE_MEM_DEFINED(obj, cache->m_type_size); /* destruct object */ diff --git a/sal/rtl/source/alloc_global.c b/sal/rtl/source/alloc_global.c index 57f3ec52dbd7..5da66ca49d96 100644 --- a/sal/rtl/source/alloc_global.c +++ b/sal/rtl/source/alloc_global.c @@ -26,6 +26,7 @@ ************************************************************************/ #include "rtl/alloc.h" +#include "alloc_impl.h" #ifndef INCLUDED_STRING_H #include <string.h> @@ -44,7 +45,6 @@ #include <stdio.h> #define INCLUDED_STDIO_H #endif -#include "alloc_impl.h" #include "internal/once.h" #include "sal/macros.h" #include "osl/diagnose.h" diff --git a/sal/rtl/source/alloc_impl.h b/sal/rtl/source/alloc_impl.h index 93f8330451d6..569c7b5f5b1b 100644 --- a/sal/rtl/source/alloc_impl.h +++ b/sal/rtl/source/alloc_impl.h @@ -259,6 +259,9 @@ typedef CRITICAL_SECTION rtl_memory_lock_type; #define VALGRIND_MEMPOOL_FREE(pool, addr) #elif defined(HAVE_VALGRIND_MEMCHECK_H) #include <valgrind/memcheck.h> +#if !defined(FORCE_SYSALLOC) +#define FORCE_SYSALLOC 1 +#endif /* !FORCE_SYSALLOC */ #endif /* NVALGRIND || HAVE_VALGRIND_MEMCHECK_H */ #ifdef __cplusplus |