Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Switch to C++
[simgrid.git] / src / mc / mc_mmalloc.h
1 /* Copyright (c) 2007-2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef MC_MMALLOC_H
8 #define MC_MMALLOC_H
9
10 #include <xbt/misc.h>
11 #include <xbt/mmalloc.h>
12
13 /** file
14  *  Support for seperate heaps.
15  *
16  *  The possible memory modes for the modelchecker are standard and raw.
17  *  Normally the system should operate in std, for switching to raw mode
18  *  you must wrap the code between MC_SET_RAW_MODE and MC_UNSET_RAW_MODE.
19  */
20
21 SG_BEGIN_DECL()
22
23 extern xbt_mheap_t std_heap;
24 extern xbt_mheap_t mc_heap;
25
26 /* FIXME: Horrible hack! because the mmalloc library doesn't provide yet of */
27 /* an API to query about the status of a heap, we simply call mmstats and */
28 /* because I now how does structure looks like, then I redefine it here */
29
30 /* struct mstats { */
31 /*   size_t bytes_total;           /\* Total size of the heap. *\/ */
32 /*   size_t chunks_used;           /\* Chunks allocated by the user. *\/ */
33 /*   size_t bytes_used;            /\* Byte total of user-allocated chunks. *\/ */
34 /*   size_t chunks_free;           /\* Chunks in the free list. *\/ */
35 /*   size_t bytes_free;            /\* Byte total of chunks in the free list. *\/ */
36 /* }; */
37
38 #define MC_SET_MC_HEAP    mmalloc_set_current_heap(mc_heap)
39 #define MC_SET_STD_HEAP  mmalloc_set_current_heap(std_heap)
40
41 SG_END_DECL()
42
43 #endif