SURFEX v8.1
General documentation of Surfex
getcurheap.c
Go to the documentation of this file.
1 #if defined(RS6K) && defined(__64BIT__)
2 #include <pthread.h>
3 #endif
4 #include <stdio.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include <signal.h>
8 #include <unistd.h>
9 #include "intercept_alloc.h"
10 #include "drhook.h"
11 extern int drhook_memtrace;
12 #include "raise.h"
13 
14 typedef long long int ll_t;
15 
16 #define WORDLEN ((ll_t)sizeof(ll_t))
17 #define RNDUP(i,n) (( ( (i) + (n) - 1 ) / (n) ) * (n))
18 #define TRUE_BYTES(x) ((x) + 4*WORDLEN) /* size, keyptr at start & padding at end */
19 
20 #if defined(CRAY) && !defined(SV2)
21 #define getcurheap GETCURHEAP
22 #define getmaxcurheap GETMAXCURHEAP
23 #define getcurheap_thread GETCURHEAP_THREAD
24 #define getmaxcurheap_thread GETMAXCURHEAP_THREAD
25 #define getmaxloc GETMAXLOC
26 #define resetmaxloc RESETMAXLOC
27 #define profile_heap_get PROFILE_HEAP_GET
28 #else
29 #define getcurheap getcurheap_
30 #define getmaxcurheap getmaxcurheap_
31 #define getcurheap_thread getcurheap_thread_
32 #define getmaxcurheap_thread getmaxcurheap_thread_
33 #define getmaxloc getmaxloc_
34 #define resetmaxloc resetmaxloc_
35 #define profile_heap_get profile_heap_get_
36 #endif
37 
38 #if !defined(NTHRDS)
39 #define NTHRDS 64 /* ***Note: A hardcoded max number of threads !!! */
40 #endif
41 
42 #if !defined(CACHELINESIZE)
43 #define CACHELINESIZE 128 /* ***Note: A hardcoded cache line size in bytes !!! */
44 #endif
45 
46 #define TIMES 0 /* 0=Normal, 1=timing locks v threads */
47 
48 static ll_t maxloc = 0; /* For stackcheck */
49 static ll_t begloc = 0; /* For stackcheck */
50 static int heapcheck = 0; /* Fro heapcheck */
51 
52 extern int get_thread_id_(void); /* ***Note: Returns YOMOML-value [1..max_threads] */
53 extern int get_proc_id_(void);
54 extern int get_max_threads_(void);
55 extern ll_t getstk_();
56 extern ll_t gethwm_();
57 #ifdef RS6K
58 extern void xl__trbk_();
59 #elif defined(NECSX)
60 extern void necsx_trbk_(const char *msg, int msglen); /* from ../utilities/gentrbk.F90 */
61 extern void necsx_trbk_fl_(const char *msg, const char *filename, int *lineno,
62  int msglen, int filenamelen); /* from ../utilities/gentrbk.F90 */
63 #define xl__trbk_() { int lineno = __LINE__; necsx_trbk_fl_("Error", __FILE__, &lineno, 5, sizeof(__FILE__)-1); }
64 #else
65 #define xl__trbk_() /* do nothing */
66 #endif
67 
68 #if defined(CLSZ_OPT)
69 #undef CLSZ_OPT
70 #endif
71 
72 #if defined(INTERCEPT_ALLOC)
73 
74 /* Intercepts F90 ALLOCATE/DEALLOCATE */
75 
76 #if defined(RS6K) && defined(__64BIT__)
77 /* Assume AIX >= 5.1 with 64-bit addressing */
78 
79 pthread_mutex_t getcurheap_lock = PTHREAD_MUTEX_INITIALIZER;
80 #define CLSZ_OPT 1
81 
82 #define EC_free __free
83 #define EC_malloc __malloc
84 #define EC_calloc __calloc
85 #define EC_realloc __realloc
86 #define EC_strdup __strdup
87 
89 
90 #elif defined(NECSX)
91 
92 #include <pthread.h>
93 pthread_mutex_t getcurheap_lock = PTHREAD_MUTEX_INITIALIZER;
94 #define CLSZ_OPT 1
95 
96 extern int EC_malloc_will_abort; /* see fnecsx.c */
97 
98 #else
99 
100 #undef INTERCEPT_ALLOC
101 
102 #endif
103 
104 #endif /* defined(INTERCEPT_ALLOC) */
105 
106 
107 static ll_t maxcurheap = 0;
108 
109 #if defined(CLSZ_OPT)
110 
111 static int profile_heap = -1; /* Profiling: -1 = UNDEF (initvalue), 0 = OFF (default), 1 = ON */
112 #define NPROFILE 9 /* byte ranges: 10**1 .. 10^9 */
113 static ll_t malloc_hits[NPROFILE+1]; /* +1 for ranges >= 10^9 */
114 static ll_t free_hits[NPROFILE+1];
115 static ll_t alloc_amount[NPROFILE+1];
116 static ll_t malloc_hits_thrd[NTHRDS][NPROFILE+1];
117 static ll_t free_hits_thrd[NTHRDS][NPROFILE+1];
118 static ll_t alloc_amount_thrd[NTHRDS][NPROFILE+1];
119 
120 static ll_t curalloc = 0;
121 
122 static struct {
125  char pad[CACHELINESIZE - 2*WORDLEN]; /* padding : e.g. 128 bytes - 2*8 bytes */
126 } clsz_opt[NTHRDS]; /* cachelinesize optimized --> less false sharing when running with OpenMP */
127 
128 #define NANS_FILL ((ll_t)0x7FF7FFFF7FF7FFFF)
129 static int nans_fill = -1; /* NaNS fill: -1 = First, 1 = ON */
130 static int free_error = 0;
131 static int max_free_error = 10;
132 
133 #ifdef RS6K
134 
135 #if 1
136 /* Turn NODISCLAIM on i.e. do NOT call disclaim() [before free()], since things get very, very expensive */
137 #if !defined(NODISCLAIM)
138 #define NODISCLAIM 1
139 #endif
140 #endif
141 
142 #else
143 
144 #if defined(NODISCLAIM)
145 #undef NODISCLAIM
146 #endif
147 #define NODISCLAIM 1
148 
149 #endif
150 
151 #ifdef RS6K
152 
153 #if !defined(NODISCLAIM)
154 #include <sys/shm.h> /* for use by disclaim() function */
155 /*
156  http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.genprogc/doc/genprogc/sys_mem_alloc.htm
157  extern int disclaim (char *Address, unsigned int Length, unsigned int Flag);
158 
159  Note: We could also use 'export MALLOCOPTIONS=disclaim', but a short test showed
160  that wall clock time went up by factor of 4, and cpu-time by factor 10 on a multithreaded MPI-code !!
161 
162  Now use 'export EC_DISCLAIM_THRESHOLD=50' to disclaim space for (say) allocations >= 50 MBytes
163 */
164 /* Try to disclaim only if size < 2^31 && size >= disclaim_threshold (see below) */
165 static double disclaim_threshold = 2048; /* In MBytes -- for convenience : max however < 2^31/1024/1024 */
167 static ll_t disclaim_threshold_limit = 2147483647;
168 #endif /* !defined(NODISCLAIM) */
169 
170 #endif /* RS6K */
171 
172 static void
173 Check_curalloc() /* Normally not called */
174 {
175  const ll_t big = (ll_t) 1000000000000L; /* 1,000,000 million bytes */
176  if (curalloc < 0 || curalloc > big) {
177  fprintf(stderr,
178  "Check_curalloc(): curalloc has probably gone crazy : Attempt to allocate ==> %lld bytes\n",curalloc);
179  xl__trbk_();
180  RAISE(SIGABRT);
181  _exit(1); /* Just in case, but shouldn't end up here at all */
182  }
183 }
184 
185 static void
187 {
188  if (profile_heap == -1) { /* First time */
189  char *env = getenv("EC_PROFILE_HEAP");
190  if (env) {
191  profile_heap = atoi(env);
192  if (profile_heap != 0) profile_heap = 1; /* OFF by export EC_PROFILE_HEAP=0 */
193  }
194  if (profile_heap != 1) profile_heap = 0;
195 #if !defined(NODISCLAIM)
196  if (disclaim_threshold_test == 0) {
197  env = getenv("EC_DISCLAIM_THRESHOLD"); /* In MBytes (can have decimals) */
198  if (env) {
199  double tmp = atof(env);
200  if (tmp > 0 || tmp < 2048) disclaim_threshold = tmp;
201  }
202  {
203  double tmp = disclaim_threshold * 1024 * 1024;
205  }
206  }
207 #endif
208  }
209 }
210 
211 static void
212 Profile_heap_put(ll_t size, int is_malloc)
213 {
214  if (profile_heap == -1) Profile_heap_init();
215  if (profile_heap == 1) {
216  int j;
217  ll_t n = 1; /* initial byte range */
218  ll_t *p = is_malloc ? malloc_hits : free_hits;
219  for (j=0; j<NPROFILE; j++) {
220  n *= 10; /* increment byte range by 10X */
221  /* BTW: Don't want log10() overhead here !! */
222  if (size < n) { /* i.e. size < pow(10,j+1) */
223  alloc_amount[j] += is_malloc ? size : -size;
224  p[j]++;
225  return;
226  }
227  }
228  j = NPROFILE;
229  alloc_amount[j] += is_malloc ? size : -size;
230  p[j]++;
231  } /* if (profile_heap == 1) */
232 }
233 
234 static void
235 Profile_heap_put_thrd(ll_t size, int is_malloc, int it)
236 {
237  if (it == 0 && profile_heap == -1) Profile_heap_init(); /* 1st thread only checks this */
238  if (profile_heap == 1) {
239  int j;
240  ll_t n = 1; /* initial byte range */
241  ll_t *p = is_malloc ? malloc_hits_thrd[it] : free_hits_thrd[it];
242  for (j=0; j<NPROFILE; j++) {
243  n *= 10; /* increment byte range by 10X */
244  /* BTW: Don't want log10() overhead here !! */
245  if (size < n) { /* i.e. size < pow(10,j+1) */
246  alloc_amount_thrd[it][j] += is_malloc ? size : -size;
247  p[j]++;
248  return;
249  }
250  }
251  j = NPROFILE;
252  alloc_amount_thrd[it][j] += is_malloc ? size : -size;
253  p[j]++;
254  } /* if (profile_heap == 1) */
255 }
256 
257 #endif /* defined(CLSZ_OPT) */
258 
259 void
261  const int *Nval,
262  const int *Icase,
263  int *nret)
264  /* Fortran callable */
265 {
266 #if defined(INTERCEPT_ALLOC)
267  int nval = *Nval;
268  int icase = *Icase;
269  int j, it, nt;
270  if (nval < 0) nval = 0;
271  if (nval > NPROFILE+1) nval = NPROFILE+1;
272  nt = get_max_threads_();
273  for (j=0; j<nval; j++) {
274  free_hits[j] = 0;
275  malloc_hits[j] = 0;
276  alloc_amount[j] = 0;
277  }
278  for (it=0; it<nt; it++) {
279  for (j=0; j<nval; j++) {
280  free_hits[j] += free_hits_thrd[it][j];
281  malloc_hits[j] += malloc_hits_thrd[it][j];
282  alloc_amount[j] += alloc_amount_thrd[it][j];
283  }
284  }
285  if (icase == 0) { /* free() hits */
286  for (j=0; j<nval; j++) val[j] = free_hits[j];
287  }
288  else if (icase == 1) { /* malloc() hits */
289  for (j=0; j<nval; j++) val[j] = malloc_hits[j];
290  }
291  else if (icase == 2) { /* outstanding allocs (malloc minus free) */
292  for (j=0; j<nval; j++) val[j] = malloc_hits[j] - free_hits[j];
293  }
294  else if (icase == 3) { /* allocation amount left per range; in bytes */
295  for (j=0; j<nval; j++) val[j] = alloc_amount[j];
296  }
297  else if (icase == 4) { /* average allocation chunk left per range; in bytes */
298  for (j=0; j<nval; j++) {
299  ll_t tmp = malloc_hits[j] - free_hits[j];
300  val[j] = (tmp > 0) ? RNDUP(alloc_amount[j],tmp)/tmp : 0;
301  }
302  }
303  else {
304  nval = 0;
305  }
306  *nret = nval;
307 #else
308  *nret = 0;
309 #endif /* defined(CLSZ_OPT) */
310 }
311 
312 
313 #if defined(CLSZ_OPT)
314 
315 void EC_free(void *vptr)
316 {
317  if (vptr) {
318  ll_t *p = vptr;
319  ll_t dummy = *--p;
320  ll_t adjsize = *--p;
321  ll_t keyptr = *--p;
322  ll_t true_bytes;
323  int it;
324  if (nans_fill == 1) {
325  ll_t *q = vptr;
326  ll_t nans = NANS_FILL;
327  ll_t j = adjsize/WORDLEN;
328  if (q[j] != nans) {
329  fprintf(stderr,"WARNING: NaNS at end of array overwritten with %e\n",q[j]);
330  xl__trbk_();
331  free_error++;
332  if (free_error > max_free_error) {
333  fprintf(stderr,"ERROR: Too many NaNS overwrites at end of arrays\n");
334  xl__trbk_(); /* Oops !! */
335  RAISE(SIGABRT);
336  _exit(1); /* Just in case, but shouldn't end up here at all */
337  }
338  }
339  }
340  it=get_thread_id_()-1;
341  true_bytes = -TRUE_BYTES(adjsize);
342 #if !defined(NODISCLAIM)
343  if (it == 0) { /* Do on OpenMP thread#1 only */
344  ll_t *addr = (ll_t *)p;
345  /* ll_t tb = -true_bytes; */
346  ll_t tb = addr[-1]; /* Since addr[-1] contains the true length in bytes */
347  if (tb >= disclaim_threshold_test &&
348  tb <= disclaim_threshold_limit) {
349  unsigned int len = (unsigned int)tb;
350  /* Important : Call disclaim(p, ...) BEFORE free(p) */
351  int rc = disclaim(p, len, ZERO_MEM);
352  /* printf("disclaim: rc=%d, len=%u, addr=%x\n",rc,len,addr); */
353  }
354  }
355 #endif
356  p[1] = 0; /* Bytes reserved reset */
357  free(p);
358  if (drhook_memtrace) pthread_mutex_lock(&getcurheap_lock);
359  clsz_opt[it].curalloca += true_bytes; /* += since true_bytes is negative */
360  if (drhook_memtrace) pthread_mutex_unlock(&getcurheap_lock);
361  if (drhook_memtrace) { ++it; c_drhook_memcounter_(&it, &true_bytes, &keyptr); --it; }
362  if (profile_heap != 0) Profile_heap_put_thrd(true_bytes, 0, it);
363  }
364 }
365 
367 {
368  double *d = NULL;
369  void *vptr = NULL;
370  ll_t keyptr = 0;
371  ll_t adjsize = size;
372  ll_t thesize = size;
373  ll_t true_bytes;
374  int it;
375  if (nans_fill == -1) { /* First time */
376  char *env = getenv("EC_FILL_NANS");
377  nans_fill=0;
378  if (env) {
379  if (strcmp(env,"true") == 0 ||
380  strcmp(env,"TRUE") == 0 ||
381  strcmp(env,"1" ) == 0) nans_fill = 1;
382  /* fprintf(stderr,"EC_FILL_NANS ==> env,env,nans_fill= 0x%x %s %d\n",env,env,nans_fill); */
383  }
384  }
385  if (adjsize < 0) adjsize = 0;
386  adjsize = RNDUP(adjsize,WORDLEN);
387 #if !defined(NECSX)
388  thesize = adjsize;
389 #endif
390  true_bytes = TRUE_BYTES(adjsize);
391  it=get_thread_id_()-1;
392  if (TIMES == 1) {
393  DRHOOK_START(dummy);
394  DRHOOK_END(0);
395  }
396  if (TIMES == 1) {
397  DRHOOK_START(malloc);
398  d = (double *)malloc(true_bytes);
399  DRHOOK_END(0);
400  }
401  else {
402  d = (double *)malloc(true_bytes);
403  }
404  vptr = d;
405  if (vptr) {
406  if (TIMES == 1) {
407  {
408  ll_t *p = vptr;
409  DRHOOK_START(lock);
410  (void) getstk_(); /* to gather near up to date stack statistics */
411  *p++ = keyptr;
412  *p++ = thesize;
413  *p++ = 0;
414  pthread_mutex_lock(&getcurheap_lock);
415  curalloc += true_bytes;
417  /* Check_curalloc(); */
418  Profile_heap_put(true_bytes, 1);
419  pthread_mutex_unlock(&getcurheap_lock);
420  vptr = p;
421  DRHOOK_END(0);
422  }
423  {
424  ll_t *p = vptr;
425  DRHOOK_START(thread);
426  (void) getstk_(); /* to gather near up to date stack statistics */
427  if (drhook_memtrace) pthread_mutex_lock(&getcurheap_lock);
428  clsz_opt[it].curalloca += true_bytes;
429  if (clsz_opt[it].maxcurheapa < clsz_opt[it].curalloca)
430  clsz_opt[it].maxcurheapa = clsz_opt[it].curalloca;
431  if (drhook_memtrace) { ++it; c_drhook_memcounter_(&it, &true_bytes, &keyptr); --it; }
432  if (drhook_memtrace) pthread_mutex_unlock(&getcurheap_lock);
433  if (profile_heap != 0) Profile_heap_put_thrd(true_bytes, 1, it);
434  DRHOOK_END(0);
435  }
436  }
437  else {
438  int ip;
439  ll_t *p = vptr;
440  ll_t q;
441  (void) getstk_(); /* to gather near up to date stack statistics */
442  *p++ = keyptr;
443  *p++ = thesize;
444  *p++ = 0;
445  if (drhook_memtrace) pthread_mutex_lock(&getcurheap_lock);
446  clsz_opt[it].curalloca += true_bytes;
447  if (clsz_opt[it].maxcurheapa < clsz_opt[it].curalloca)
448  clsz_opt[it].maxcurheapa = clsz_opt[it].curalloca;
449  if (drhook_memtrace) { ++it; c_drhook_memcounter_(&it, &true_bytes, &keyptr); --it; }
450  if (drhook_memtrace) pthread_mutex_unlock(&getcurheap_lock);
451  if (profile_heap != 0) Profile_heap_put_thrd(true_bytes, 1, it);
452  if (nans_fill == 1) {
453  int j;
454  ll_t nans = NANS_FILL;
455  for (j=0; j<(WORDLEN+adjsize)/WORDLEN; j++) {
456  p[j]=nans;
457  }
458  }
459  if(heapcheck == 1) {
460  it=get_thread_id_();
461  ip=get_proc_id_();
462  if (it == 1 && ip == 1 ) {
463  if (begloc == 0) begloc=(ll_t)p;
464  q=(ll_t)p+true_bytes;
465  if (q > maxloc) {
466  maxloc=q;
467 /*
468  fprintf(stderr,"JJJ pntr= %d %ld %ld %ld %ld %ld\n",it,maxloc-begloc,maxloc,begloc,p,true_bytes);
469  xl__trbk_();
470 */
471  }
472  }
473  }
474  vptr=p;
475  }
476  }
477  else {
478  pthread_mutex_lock(&getcurheap_lock);
479  fprintf(stderr,
480  "EC_malloc(size=%lld => thesize=%lld => adjsize=%lld, true_bytes=%lld bytes) failed in file=%s, line=%d\n",
481  size, thesize, adjsize, true_bytes, __FILE__, __LINE__);
482  xl__trbk_(); /* Oops !! */
483  if (EC_malloc_will_abort) RAISE(SIGABRT);
484  pthread_mutex_unlock(&getcurheap_lock);
485  if (EC_malloc_will_abort) _exit(1); /* Just in case, but shouldn't end up here at all */
486  }
487  return vptr;
488 }
489 
490 void *EC_calloc(ll_t nelem, ll_t elsize)
491 {
492  ll_t totbytes = nelem * elsize;
493  void *p = EC_malloc(totbytes);
494  if (p) memset(p, 0, totbytes);
495  return p;
496 }
497 
498 void *EC_realloc(void *vptr, ll_t size)
499 {
500  ll_t *pnew = NULL;
501  if (vptr) {
502  ll_t *p = vptr;
503  ll_t oldsize = p[-1];
504  if (oldsize < size) {
505  pnew = EC_malloc(size);
506  if (pnew) {
507  memcpy(pnew, p, oldsize);
508  EC_free(p);
509  }
510  }
511  else { /* the old allocation size was already sufficient */
512  pnew = p;
513  }
514  }
515  else { /* Revert to malloc() */
516  pnew = EC_malloc(size);
517  }
518  return pnew;
519 }
520 
521 char *EC_strdup(const char *s)
522 {
523  ll_t totbytes = sizeof(*s) * strlen(s);
524  return EC_malloc(totbytes);
525 }
526 
527 #endif /* defined(CLSZ_OPT) */
528 
529 ll_t
531 {
532 #if defined(CLSZ_OPT)
533  int it = get_thread_id_();
534  ll_t curvalue = clsz_opt[it-1].curalloca;
535  if (it == 1) { /* Only thread#1 sums up */
536  int i, nt = get_max_threads_();
537  if (drhook_memtrace) pthread_mutex_lock(&getcurheap_lock);
538  for (i=1; i<nt; i++) {
539  curvalue += clsz_opt[i].curalloca;
540  }
541  if (drhook_memtrace) pthread_mutex_unlock(&getcurheap_lock);
542  }
543  return curvalue;
544 #elif defined(_CRAYC)
547 #else
548  ll_t rc = gethwm_();
549  if (rc > maxcurheap) maxcurheap = rc;
550  return rc;
551 #endif
552 }
553 
554 ll_t
555 getcurheap_thread(const int *thread_id)
556 {
557 #if defined(CLSZ_OPT)
558  int it = (thread_id && (*thread_id > 0)) ? *thread_id : get_thread_id_();
559  return clsz_opt[--it].curalloca;
560 #else
561  return getcurheap();
562 #endif
563 }
564 
565 /* Maximum (total) current (virtual mem) allocation encountered */
566 
567 ll_t
569 {
570 #if defined(CLSZ_OPT)
571  ll_t maxcurheap_local=0;
572  int it, nt = get_max_threads_();
573  if (drhook_memtrace) pthread_mutex_lock(&getcurheap_lock);
574  for (it=0; it<nt; it++) {
575  maxcurheap_local += clsz_opt[it].maxcurheapa;
576  }
577  if (maxcurheap < maxcurheap_local) maxcurheap = maxcurheap_local;
578  if (drhook_memtrace) pthread_mutex_unlock(&getcurheap_lock);
579  return maxcurheap_local;
580 #else
581  return 0;
582 #endif
583 }
584 
585 /* Maximum (total) current (virtual mem) allocation encountered per thread */
586 
587 ll_t
588 getmaxcurheap_thread(const int *thread_id) /* ***Note: YOMOML thread id */
589 {
590 #if defined(CLSZ_OPT)
591  int it = (thread_id && (*thread_id > 0)) ? *thread_id : get_thread_id_();
592  return clsz_opt[--it].maxcurheapa;
593 #else
594  return 0;
595 #endif
596 }
597 
598 #if 1
599 ll_t
601 {
602  ll_t z=maxloc-begloc;
603  return z;
604 }
605 
606 void
608 {
609  maxloc=0;
610 }
611 
612 void
613 
615 {
616  heapcheck=1;
617 }
618 
619 #endif
620 
ll_t getmaxloc()
Definition: getcurheap.c:600
static long size
Definition: bytes_io.c:262
static struct @0 clsz_opt[NTHRDS]
static ll_t disclaim_threshold_test
Definition: getcurheap.c:166
ll_t getcurheap_thread(const int *thread_id)
Definition: getcurheap.c:555
void resetmaxloc()
Definition: getcurheap.c:607
char pad[CACHELINESIZE - 2 *WORDLEN]
Definition: getcurheap.c:125
static void Profile_heap_put_thrd(ll_t size, int is_malloc, int it)
Definition: getcurheap.c:235
void setheapcheck_()
Definition: getcurheap.c:614
ll_t getmaxcurheap_thread(const int *thread_id)
Definition: getcurheap.c:588
static void Profile_heap_init()
Definition: getcurheap.c:186
void necsx_trbk_(const char *msg, int msglen)
long long int ll_t
Definition: getcurheap.c:14
static ll_t curalloc
Definition: getcurheap.c:120
static ll_t malloc_hits_thrd[NTHRDS][NPROFILE+1]
Definition: getcurheap.c:116
static void Profile_heap_put(ll_t size, int is_malloc)
Definition: getcurheap.c:212
static ll_t alloc_amount[NPROFILE+1]
Definition: getcurheap.c:115
static ll_t disclaim_threshold_limit
Definition: getcurheap.c:167
static ll_t alloc_amount_thrd[NTHRDS][NPROFILE+1]
Definition: getcurheap.c:118
void profile_heap_get(ll_t val[], const int *Nval, const int *Icase, int *nret)
Definition: getcurheap.c:260
static int profile_heap
Definition: getcurheap.c:111
ll_t maxcurheapa
Definition: getcurheap.c:124
long long int ll_t
Definition: privpub.h:293
static ll_t free_hits_thrd[NTHRDS][NPROFILE+1]
Definition: getcurheap.c:117
int drhook_memtrace
Definition: drhook.c:79
static ll_t malloc_hits[NPROFILE+1]
Definition: getcurheap.c:113
void * EC_realloc(void *vptr, ll_t size)
Definition: getcurheap.c:498
ll_t getstk_()
Definition: getstk.c:24
static int heapcheck
Definition: getcurheap.c:50
static double disclaim_threshold
Definition: getcurheap.c:165
pthread_mutex_t getcurheap_lock
Definition: getcurheap.c:79
static int free_error
Definition: getcurheap.c:130
void c_drhook_memcounter_(const int *thread_id, const long long int *size, long long int *keyptr_addr)
Definition: drhook.c:3392
char * EC_strdup(const char *s)
Definition: getcurheap.c:521
void * EC_calloc(ll_t nelem, ll_t elsize)
Definition: getcurheap.c:490
int get_proc_id_(void)
int get_thread_id_(void)
ERROR in n
Definition: ecsort_shared.h:90
static void Check_curalloc()
Definition: getcurheap.c:173
ll_t curalloca
Definition: getcurheap.c:123
void necsx_trbk_fl_(const char *msg, const char *filename, int *lineno, int msglen, int filenamelen)
static ll_t free_hits[NPROFILE+1]
Definition: getcurheap.c:114
ll_t gethwm_()
void EC_free(void *vptr)
Definition: getcurheap.c:315
static ll_t maxloc
Definition: getcurheap.c:48
static ll_t maxcurheap
Definition: getcurheap.c:107
ll_t getcurheap()
Definition: getcurheap.c:530
size_t get_tcmalloc_current_allocated_bytes_()
ll_t getmaxcurheap()
Definition: getcurheap.c:568
void xl__trbk_()
static ll_t begloc
Definition: getcurheap.c:49
int EC_malloc_will_abort
Definition: getcurheap.c:88
void * EC_malloc(ll_t size)
Definition: getcurheap.c:366
int get_max_threads_(void)
static int nans_fill
Definition: getcurheap.c:129
static int max_free_error
Definition: getcurheap.c:131