12 #include <mach/task.h>
13 #include <mach/mach_init.h>
14 #include <malloc/malloc.h>
22 #include <util/pragma_push.def>
24 #pragma warning(disable:4668)
29 #include <util/pragma_pop.def>
36 #if defined(__linux__) && defined(__GLIBC__)
38 struct mallinfo m = mallinfo();
39 out <<
" non-mmapped space allocated from system: " << m.arena <<
"\n";
40 out <<
" number of free chunks: " << m.ordblks <<
"\n";
41 out <<
" number of fastbin blocks: " << m.smblks <<
"\n";
42 out <<
" number of mmapped regions: " << m.hblks <<
"\n";
43 out <<
" space in mmapped regions: " << m.hblkhd <<
"\n";
44 out <<
" maximum total allocated space: " << m.usmblks <<
"\n";
45 out <<
" space available in freed fastbin blocks: " << m.fsmblks <<
"\n";
46 out <<
" total allocated space: " << m.uordblks <<
"\n";
47 out <<
" total free space: " << m.fordblks <<
"\n";
53 PROCESS_MEMORY_COUNTERS pmc;
54 if(GetProcessMemoryInfo(GetCurrentProcess(), &pmc,
sizeof(pmc)))
56 out <<
" PeakWorkingSetSize: " << pmc.PeakWorkingSetSize <<
"\n";
57 out <<
" WorkingSetSize: " << pmc.WorkingSetSize <<
"\n";
64 struct task_basic_info t_info;
65 mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
67 current_task(), TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count);
68 out <<
" virtual size: "
69 << static_cast<double>(t_info.virtual_size)/1000000 <<
"m\n";
71 malloc_statistics_t t;
72 malloc_zone_statistics(NULL, &t);
73 out <<
" max_size_in_use: "
74 << static_cast<double>(t.max_size_in_use)/1000000 <<
"m\n";
75 out <<
" size_allocated: "
76 << static_cast<double>(t.size_allocated)/1000000 <<
"m\n";