00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #pragma once
00019
00020 namespace mongo {
00021
00022 inline void * ourmalloc(size_t size) {
00023 void *x = malloc(size);
00024 if ( x == 0 ) dbexit( EXIT_OOM_MALLOC , "malloc fails");
00025 return x;
00026 }
00027
00028 inline void * ourrealloc(void *ptr, size_t size) {
00029 void *x = realloc(ptr, size);
00030 if ( x == 0 ) dbexit( EXIT_OOM_REALLOC , "realloc fails");
00031 return x;
00032 }
00033
00034 #define MONGO_malloc mongo::ourmalloc
00035 #define malloc MONGO_malloc
00036 #define MONGO_realloc mongo::ourrealloc
00037 #define realloc MONGO_realloc
00038
00039 }