|
@@ -27,6 +27,7 @@
|
|
|
|
|
|
|
|
#include "dmmlib/dmmlib.h"
|
|
#include "dmmlib/dmmlib.h"
|
|
|
|
|
|
|
|
|
|
+#include "tls_allocator.h"
|
|
|
#include "default_rb.h"
|
|
#include "default_rb.h"
|
|
|
#include "dmmlib_trace.h"
|
|
#include "dmmlib_trace.h"
|
|
|
#include "locks.h"
|
|
#include "locks.h"
|
|
@@ -42,7 +43,8 @@ void free(void *ptr) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#if defined PARSE_ENV && defined WITH_MEM_TRACE
|
|
#if defined PARSE_ENV && defined WITH_MEM_TRACE
|
|
|
- if(__builtin_expect (systemallocator->initialized, true)) {
|
|
|
|
|
|
|
+ get_tls_allocator();
|
|
|
|
|
+ if(__builtin_expect (tls_allocator->initialized, true)) {
|
|
|
#endif /* PARSE_ENV && WITH_MEM_TRACE */
|
|
#endif /* PARSE_ENV && WITH_MEM_TRACE */
|
|
|
MEM_TRACE("dmmlib - f %p\n", ptr);
|
|
MEM_TRACE("dmmlib - f %p\n", ptr);
|
|
|
#if defined PARSE_ENV && defined WITH_MEM_TRACE
|
|
#if defined PARSE_ENV && defined WITH_MEM_TRACE
|
|
@@ -50,7 +52,8 @@ void free(void *ptr) {
|
|
|
#endif /* PARSE_ENV && WITH_MEM_TRACE */
|
|
#endif /* PARSE_ENV && WITH_MEM_TRACE */
|
|
|
|
|
|
|
|
owner_raw_block = find_raw_block_owner(ptr);
|
|
owner_raw_block = find_raw_block_owner(ptr);
|
|
|
- if( (uintptr_t) owner_raw_block + sizeof(raw_block_header_t) != (uintptr_t) ptr) {
|
|
|
|
|
|
|
+ if( (uintptr_t) owner_raw_block + sizeof(raw_block_header_t) !=
|
|
|
|
|
+ (uintptr_t) ptr) {
|
|
|
/* It is not a big block, so act accordingly. */
|
|
/* It is not a big block, so act accordingly. */
|
|
|
DEFAULT_RB_T *encapsulated_rb = (DEFAULT_RB_T *)
|
|
DEFAULT_RB_T *encapsulated_rb = (DEFAULT_RB_T *)
|
|
|
((uintptr_t) owner_raw_block + sizeof(raw_block_header_t));
|
|
((uintptr_t) owner_raw_block + sizeof(raw_block_header_t));
|
|
@@ -64,15 +67,19 @@ void free(void *ptr) {
|
|
|
((uintptr_t) ptr - sizeof(raw_block_header_t));
|
|
((uintptr_t) ptr - sizeof(raw_block_header_t));
|
|
|
|
|
|
|
|
#ifdef WITH_ALLOCATOR_STATS
|
|
#ifdef WITH_ALLOCATOR_STATS
|
|
|
|
|
+#if !defined PARSE_ENV || (defined PARSE_ENV && !defined MEM_TRACE) || \
|
|
|
|
|
+ !defined COALESCING_VARIABLE
|
|
|
|
|
+ get_tls_allocator();
|
|
|
|
|
+#endif /* !PARSE_ENV || (PARSE_ENV && !MEM_TRACE) || !COALESCING_VARIABLE */
|
|
|
LOCK_GLOBAL();
|
|
LOCK_GLOBAL();
|
|
|
update_stats
|
|
update_stats
|
|
|
- ( &systemallocator->dmm_stats
|
|
|
|
|
|
|
+ ( &tls_allocator->dmm_stats
|
|
|
, FREE
|
|
, FREE
|
|
|
#ifdef REQUEST_SIZE_INFO
|
|
#ifdef REQUEST_SIZE_INFO
|
|
|
, owner_raw_block->requested_size
|
|
, owner_raw_block->requested_size
|
|
|
#endif /* REQUEST_SIZE_INFO */
|
|
#endif /* REQUEST_SIZE_INFO */
|
|
|
);
|
|
);
|
|
|
- systemallocator->dmm_stats.total_mem_allocated -= owner_raw_block->size;
|
|
|
|
|
|
|
+ tls_allocator->dmm_stats.total_mem_allocated -= owner_raw_block->size;
|
|
|
UNLOCK_GLOBAL();
|
|
UNLOCK_GLOBAL();
|
|
|
#endif /* WITH_ALLOCATOR_STATS */
|
|
#endif /* WITH_ALLOCATOR_STATS */
|
|
|
|
|
|