ATLAS Offline Software
mallinfo.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 /*
3  * Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
4  */
13 #ifndef PERFMONEVENT_MALLINFO_H
14 #define PERFMONEVENT_MALLINFO_H
15 
16 
17 #include "CxxUtils/features.h"
18 
19 
20 #ifndef __APPLE__
21 #include <malloc.h>
22 
23 namespace PerfMon {
24 #if HAVE_MALLINFO2
25 using mallinfo_t = struct mallinfo2;
26 inline mallinfo_t mallinfo() { return ::mallinfo2(); }
27 #else
28 using mallinfo_t = struct mallinfo;
30 #endif
31 }
32 
33 #else /* brain dead macos: define a dummy mallinfo structure */
34 struct mallinfo {
35  int arena;
36  int ordblks; /* number of free chunks */
37  int smblks; /* number of fastbin blocks */
38  int hblks; /* number of mmapped regions */
39  int hblkhd; /* space in mmapped regions */
40  int usmblks; /* maximum total allocated space */
41  int fsmblks; /* space available in freed fastbin blocks */
42  int uordblks; /* total allocated space */
43  int fordblks; /* total free space */
44  int keepcost; /* top-most, releasable (via malloc_trim) space */
45 };
46 namespace PerfMon {
47 using mallinfo_t = struct mallinfo;
48 }
49 #endif
50 
51 
52 #endif // not PERFMONEVENT_MALLINFO_H
features.h
Some additional feature test macros.
PerfMon::mallinfo
mallinfo_t mallinfo()
Definition: mallinfo.h:29
PerfMon
a simple malloc wrapper that keeps track of the amount of memory allocated on the heap.
Definition: CallGraphAuditor.cxx:24
PerfMon::mallinfo_t
struct mallinfo mallinfo_t
Definition: mallinfo.h:28