Debian Codegraph @

src/memory.cc

raw
1 /*
2 * This file is part of MUSIC.
3 * Copyright (C) 2012 INCF
4 *
5 * MUSIC is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * MUSIC is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include <iostream>
20
21 extern "C" {
22 #ifdef __APPLE__
23 #include <malloc/malloc.h>
24 #else
25 #include <malloc.h>
26 #endif
27 }
28
29 #include "music/memory.hh"
30
31 #include "../config.h"
32
33 namespace MUSIC {
34
35 void
36 reportMem ()
37 {
38 #ifdef HAVE_MALLINFO
39 struct mallinfo minfo = mallinfo ();
40 std::cout << "Allocated with sbrk (arena): " << minfo.arena << std::endl;
41 std::cout << "Allocated with mmap (hblkhd): " << minfo.hblkhd << std::endl;
42 std::cout << "Chunks handed out by malloc (uordblks): " << minfo.uordblks << std::endl;
43 std::cout << "Free memory in pool (fordblks): " << minfo.fordblks << std::endl;
44 #endif
45 }
46
47 }