Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
1148c7272d9d15e8e9da490b615e7d44eca87f4e
[simgrid.git] / include / xbt / mmalloc.h
1 /* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
2    This file was then part of the GNU C Library. */
3
4 /* Copyright (c) 2010-2012. The SimGrid Team.
5  * All rights reserved.                                                     */
6
7 /* This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. */
9
10
11 #ifndef MMALLOC_H
12 #define MMALLOC_H 1
13
14 #ifdef HAVE_STDDEF_H
15 #  include <stddef.h>
16 #else
17 #  include <sys/types.h>        /* for size_t */
18 #  include <stdio.h>            /* for NULL */
19 #endif
20
21 /* Allocate SIZE bytes of memory.  */
22 extern void *mmalloc(void *md, size_t size);
23
24 /* Re-allocate the previously allocated block in void*, making the new block
25    SIZE bytes long.  */
26 extern void *mrealloc(void *md, void *ptr, size_t size);
27
28 /* Allocate NMEMB elements of SIZE bytes each, all initialized to 0.  */
29 extern void *mcalloc(void *md, size_t nmemb, size_t size);
30
31 /* Free a block allocated by `mmalloc', `mrealloc' or `mcalloc'.  */
32 extern void mfree(void *md, void *ptr);
33
34 /* Allocate SIZE bytes allocated to ALIGNMENT bytes.  */
35 extern void *mmemalign(void *md, size_t alignment, size_t size);
36
37 /* Allocate SIZE bytes on a page boundary.  */
38 extern void *mvalloc(void *md, size_t size);
39
40 extern void *mmalloc_attach(int fd, void *baseaddr);
41
42 extern void mmalloc_pre_detach(void *md);
43
44 extern void *mmalloc_detach(void *md);
45
46 /* return the heap used when NULL is passed as first argument to any mm* function */
47 extern void *mmalloc_get_default_md(void);
48
49 extern int mmtrace(void);
50
51 extern void *mmalloc_findbase(int size);
52
53 extern int mmalloc_compare_heap(void *h1, void *h2, void *std_heap_addr);
54
55 extern void mmalloc_display_info_heap(void *h);
56
57 /* To change the heap used when using the legacy version malloc/free/realloc and such */
58 void mmalloc_set_current_heap(void *new_heap);
59 void *mmalloc_get_current_heap(void);
60
61
62
63 #endif                          /* MMALLOC_H */