43 #include "Parser_dh.h" 
   71 #define __FUNC__ "Mem_dhCreate" 
   83   tmp->mallocCount = 0.0;
 
   89 #define __FUNC__ "Mem_dhDestroy" 
   93   START_FUNC_DH 
if (Parser_dhHasSwitch (parser_dh, 
"-eu_mem"))
 
   95       Mem_dhPrint (m, stdout, 
false);
 
  104 #define __FUNC__ "Mem_dhMalloc" 
  106 Mem_dhMalloc (
Mem_dh m, 
size_t size)
 
  108   START_FUNC_DH_2 
void *retval;
 
  113   address = PRIVATE_MALLOC (s);
 
  118            "PRIVATE_MALLOC failed; totalMem = %g; requested additional = %i",
 
  119            m->totalMem, (
int) s);
 
  120       SET_ERROR (NULL, msgBuf_dh);
 
  131   tmp->size = (double) s;
 
  134   m->totalMem += (double) s;
 
  135   m->curMem += (double) s;
 
  136   m->maxMem = MAX (m->maxMem, m->curMem);
 
  138 END_FUNC_VAL_2 (retval)}
 
  142 #define __FUNC__ "Mem_dhFree" 
  144 Mem_dhFree (
Mem_dh m, 
void *ptr)
 
  146   START_FUNC_DH_2 
double size;
 
  147   char *tmp = (
char *) ptr;
 
  153   mem_dh->curMem -= size;
 
  154   mem_dh->freeCount += 1;
 
  161 #define __FUNC__ "Mem_dhPrint" 
  163 Mem_dhPrint (
Mem_dh m, FILE * fp, 
bool allPrint)
 
  165   START_FUNC_DH_2 
if (fp == NULL)
 
  166     SET_V_ERROR (
"fp == NULL");
 
  167   if (myid_dh == 0 || allPrint)
 
  170       fprintf (fp, 
"---------------------- Euclid memory report (start)\n");
 
  171       fprintf (fp, 
"malloc calls = %g\n", m->mallocCount);
 
  172       fprintf (fp, 
"free   calls = %g\n", m->freeCount);
 
  173       fprintf (fp, 
"curMem          = %g Mbytes (should be zero)\n",
 
  174            m->curMem / 1000000);
 
  175       tmp = m->totalMem / 1000000;
 
  176       fprintf (fp, 
"total allocated = %g Mbytes\n", tmp);
 
  178            "max malloc      = %g Mbytes (max allocated at any point in time)\n",
 
  179            m->maxMem / 1000000);
 
  181       fprintf (fp, 
"---------------------- Euclid memory report (end)\n");