/*************************************************************************** shxmalloc.cpp - description ------------------- begin : Tue Jan 10 08:23:39 2006 copyright : (C) 2002 by Cavalli Andrea email : cavalli@bioc.unizh.ch **************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include #include using namespace std; static vector shx_momory_pool; int shx_momory_pool_init_(){ shx_momory_pool = vector(); return 0; } static int shx_momory_pool_init = shx_momory_pool_init_(); extern "C" { void *SHX_calloc(size_t nmemb, size_t size){ void * ptr = calloc(nmemb,size); shx_momory_pool.push_back(ptr); return ptr; } void *SHX_malloc(size_t size){ void * ptr = malloc(size); shx_momory_pool.push_back(ptr); return ptr; } void *SHX_realloc(void *ptr, size_t size){ void * ptr2 = realloc(ptr, size); if(ptr2!=ptr) shx_momory_pool.push_back(ptr2); return ptr2; } void SHX_free(void *ptr){} void SHX_clean(){ int size = shx_momory_pool.size(); for(int i=0;i