Commit 131d01c3 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

refs #5368 make some lock tree tests use the memory.h api


git-svn-id: file:///svn/toku/tokudb@48324 c7de825b-a66e-492c-adef-691d508d4ae1
parent e9f17601
......@@ -13,17 +13,9 @@
#ifndef TOKU_ALLOW_DEPRECATED
#define TOKU_ALLOW_DEPRECATED
#endif
#if defined(HAVE_MALLOC_H)
# include <malloc.h>
#elif defined(HAVE_SYS_MALLOC_H)
# include <sys/malloc.h>
# if defined(HAVE_MALLOC_MALLOC_H)
# include <malloc/malloc.h>
# endif
#endif
#include "test.h"
#include <memory.h>
#include <toku_byteswap.h>
#include <dlfcn.h>
static uint64_t htonl64(uint64_t x) {
#if BYTE_ORDER == LITTLE_ENDIAN
......@@ -33,15 +25,6 @@ static uint64_t htonl64(uint64_t x) {
#endif
}
#if defined(HAVE_MALLOC_USABLE_SIZE)
typedef size_t (*malloc_usable_size_fun_t)(void *p);
size_t malloc_usable_size(void *p) __THROW;
static malloc_usable_size_fun_t malloc_usable_size_f = malloc_usable_size;
#elif defined(HAVE_MALLOC_SIZE)
typedef size_t (*malloc_usable_size_fun_t)(const void *p);
static malloc_usable_size_fun_t malloc_usable_size_f = malloc_size;
#endif
struct my_ltm_status {
uint32_t max_locks, curr_locks;
uint64_t max_lock_memory, curr_lock_memory;
......@@ -59,7 +42,7 @@ static void my_ltm_get_status(toku_ltm *ltm, struct my_ltm_status *my_status) {
static void *my_malloc(size_t s) {
void * p = malloc(s);
if (verbose)
printf("%s %lu %lu\n", __FUNCTION__, s, malloc_usable_size_f(p));
printf("%s %lu %lu\n", __FUNCTION__, s, toku_malloc_usable_size(p));
return p;
}
......@@ -71,7 +54,7 @@ static void *my_realloc(void *p, size_t s) {
static void my_free(void *p) {
if (verbose)
printf("%s %p %lu\n", __FUNCTION__, p, malloc_usable_size_f(p));
printf("%s %p %lu\n", __FUNCTION__, p, toku_malloc_usable_size(p));
free(p);
}
......
......@@ -13,17 +13,9 @@
#ifndef TOKU_ALLOW_DEPRECATED
#define TOKU_ALLOW_DEPRECATED
#endif
#if defined(HAVE_MALLOC_H)
# include <malloc.h>
#elif defined(HAVE_SYS_MALLOC_H)
# include <sys/malloc.h>
# if defined(HAVE_MALLOC_MALLOC_H)
# include <malloc/malloc.h>
# endif
#endif
#include "test.h"
#include <memory.h>
#include <toku_byteswap.h>
#include <dlfcn.h>
static uint64_t htonl64(uint64_t x) {
#if BYTE_ORDER == LITTLE_ENDIAN
......@@ -33,15 +25,6 @@ static uint64_t htonl64(uint64_t x) {
#endif
}
#if defined(HAVE_MALLOC_USABLE_SIZE)
typedef size_t (*malloc_usable_size_fun_t)(void *p);
size_t malloc_usable_size(void *p) __THROW;
static malloc_usable_size_fun_t malloc_usable_size_f = malloc_usable_size;
#elif defined(HAVE_MALLOC_SIZE)
typedef size_t (*malloc_usable_size_fun_t)(const void *p);
static malloc_usable_size_fun_t malloc_usable_size_f = malloc_size;
#endif
struct my_ltm_status {
uint32_t max_locks, curr_locks;
uint64_t max_lock_memory, curr_lock_memory;
......@@ -59,7 +42,7 @@ static void my_ltm_get_status(toku_ltm *ltm, struct my_ltm_status *my_status) {
static void *my_malloc(size_t s) {
void * p = malloc(s);
if (verbose)
printf("%s %lu %lu\n", __FUNCTION__, s, malloc_usable_size_f(p));
printf("%s %lu %lu\n", __FUNCTION__, s, toku_malloc_usable_size(p));
return p;
}
......@@ -71,7 +54,7 @@ static void *my_realloc(void *p, size_t s) {
static void my_free(void *p) {
if (verbose)
printf("%s %p %lu\n", __FUNCTION__, p, malloc_usable_size_f(p));
printf("%s %p %lu\n", __FUNCTION__, p, toku_malloc_usable_size(p));
free(p);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment