19 #include <ndb_global.h> 
   20 #include "ndbd_malloc.hpp" 
   28 extern void do_refresh_watch_dog(Uint32 place);
 
   31 ndbd_alloc_touch_mem(
void *p, 
size_t sz, 
volatile Uint32 * watchCounter)
 
   34   if (watchCounter == 0)
 
   37   unsigned char * ptr = (
unsigned char*)p;
 
   48 static void xxx(
size_t size, 
size_t *s_m, 
size_t *s_k, 
size_t *s_b)
 
   50   *s_m = size/1024/1024;
 
   51   *s_k = (size - *s_m*1024*1024)/1024;
 
   52   *s_b = size - *s_m*1024*1024-*s_k*1024;
 
   56 static Uint64 g_allocated_memory;
 
   57 void *ndbd_malloc(
size_t size)
 
   59   void *p = NdbMem_Allocate(size);
 
   62     g_allocated_memory += 
size;
 
   64     ndbd_alloc_touch_mem(p, size, 0);
 
   69       xxx(size, &s_m, &s_k, &s_b);
 
   70       fprintf(stderr, 
"%p malloc(%um %uk %ub)", p, s_m, s_k, s_b);
 
   71       xxx(g_allocated_memory, &s_m, &s_k, &s_b);
 
   72       fprintf(stderr, 
"\t\ttotal(%um %uk %ub)\n", s_m, s_k, s_b);
 
   79 void ndbd_free(
void *p, 
size_t size)
 
   84     g_allocated_memory -= 
size;
 
   86     fprintf(stderr, 
"%p free(%d)\n", p, size);