Commit af1fc4d3 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

move toku_malloc to the port layer. closes #1342

git-svn-id: file:///svn/toku/tokudb.1032b@8423 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9c482214
/* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "toku_portability.h"
#include "memory.h"
#include "toku_assert.h"
#include <string.h>
#include <malloc.h>
#include <errno.h>
int toku_memory_check=0;
int toku_calloc_counter = 0;
int toku_malloc_counter = 0;
int toku_realloc_counter = 0;
int toku_free_counter = 0;
void *toku_calloc(size_t nmemb, size_t size) {
toku_calloc_counter++;
return calloc(nmemb, size);
}
void *toku_malloc(size_t size) {
toku_malloc_counter++;
return malloc(size);
}
void *toku_xmalloc(size_t size) {
void *r = toku_malloc(size);
if (r==0) abort();
return r;
}
void *toku_tagmalloc(size_t size, enum typ_tag typtag) {
//printf("%s:%d tagmalloc\n", __FILE__, __LINE__);
void *r = toku_malloc(size);
if (!r) return 0;
assert(size>sizeof(int));
((int*)r)[0] = typtag;
return r;
}
void *toku_realloc(void *p, size_t size) {
toku_realloc_counter++;
return realloc(p, size);
}
void toku_free(void* p) {
toku_free_counter++;
free(p);
}
void toku_free_n(void* p, size_t size __attribute__((unused))) {
toku_free(p);
}
void *toku_memdup (const void *v, size_t len) {
void *r=toku_malloc(len);
memcpy(r,v,len);
return r;
}
char *toku_strdup (const char *s) {
return toku_memdup(s, strlen(s)+1);
}
void toku_memory_check_all_free (void) {
}
int toku_get_n_items_malloced (void) { return 0; }
void toku_print_malloced_items (void) {
}
void toku_malloc_report (void) {
}
void toku_malloc_cleanup (void) {
}
......@@ -49,7 +49,6 @@ BRT_SOURCES = \
leafentry \
log \
log_code \
memory \
memarena \
mempool \
omt \
......
......@@ -18,7 +18,7 @@ int toku_realloc_counter = 0;
int toku_free_counter = 0;
static inline size_t resize(size_t n) {
#if defined(_WIN32)
#if defined(_WIN32) || defined(_WIN64)
if (64*1024 < n && n < 1024*1024)
n = 1024*1024;
return n;
......
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