Logo ROOT  
Reference Guide
mmalloc.h
Go to the documentation of this file.
1/* @(#)root/clib:$Id$ */
2/* Author: */
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef MMALLOC_H
13#define MMALLOC_H 1
14
15/* FIXME: If <stddef.h> doesn't exist, you'll need to do something
16 to define size_t before including this file. Like upgrading
17 to a system with an ANSI C environment. */
18
19#include "mmconfig.h"
20
21#ifdef WIN32
22# include <windows.h>
23#endif
24
25#ifdef R__HAVE_STDDEF_H
26# include <stddef.h>
27#endif
28
29#define PTR void *
30#define PARAMS(paramlist) paramlist
31
32#ifdef WIN32
33 extern struct mmstats_t mmstats PARAMS ((PTR));
34#endif
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/* Allocate SIZE bytes of memory. */
41
42extern PTR mmalloc PARAMS ((PTR, size_t));
43
44/* Re-allocate the previously allocated block in PTR, making the new block
45 SIZE bytes long. */
46
47extern PTR mrealloc PARAMS ((PTR, PTR, size_t));
48
49/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
50
51extern PTR mcalloc PARAMS ((PTR, size_t, size_t));
52
53/* Free a block allocated by `mmalloc', `mrealloc' or `mcalloc'. */
54
55extern void mfree PARAMS ((PTR, PTR));
56
57/* Allocate SIZE bytes allocated to ALIGNMENT bytes. */
58
59extern PTR mmemalign PARAMS ((PTR, size_t, size_t));
60
61/* Allocate SIZE bytes on a page boundary. */
62
63extern PTR mvalloc PARAMS ((PTR, size_t));
64
65/* Activate a standard collection of debugging hooks. */
66
67extern int mmcheck PARAMS ((PTR, void (*) (void)));
68
69/* Pick up the current statistics is no longer supported via mmstats. (see FIXME elsewhere) */
70/* This cause a problem with VC++ (warning C4190) if extern "C" and with clang:
71include/mmalloc.h:73:25: warning: 'mmstats' has C-linkage specified, but returns user-defined type 'struct mmstats_t' which is incompatible with C [-Wreturn-type-c-linkage]
72 This is because mmstats_t is only (intentionally see the FIXME) declared in mmprivate.h
73 and C (or just VC++ and clang in extern "C" mode) requires the struct to be fully
74 declared before it is used (likely so that it can know whether it is a POD or not).
75 Since mmprivate.h first include mmalloc.h, even including expliclty mmprivate.h
76 we still can not get in a position where struct mmstats_t is fully declared before
77 the next line is parsed ... Since the FIXME in mmprivate.h says that anyhow
78 the data should not be provided using this struct mmstats_t ... we just comment
79 this comment it out.
80*/
81 // extern struct mmstats_t mmstats PARAMS ((PTR));
82
83#ifndef WIN32
84 extern PTR mmalloc_attach PARAMS ((int, PTR, int));
85#else
86 extern PTR mmalloc_attach PARAMS ((HANDLE, PTR, int));
87#endif
88
90
91extern int mmalloc_update_mapping PARAMS ((PTR));
92
93extern int mmalloc_setkey PARAMS ((PTR, int, PTR));
94
95extern PTR mmalloc_getkey PARAMS ((PTR, int));
96
97extern int mmtrace PARAMS ((void));
98
99#ifdef __cplusplus
100}
101#endif
102
103#endif /* MMALLOC_H */
#define PARAMS(protos)
PTR mmalloc_attach(int fd, PTR baseaddr)
Definition attach.c:328
PTR mmalloc_detach(PTR md)
Definition detach.c:44
int mmalloc_setkey(PTR md, int keynum, PTR key)
Definition keys.c:44
PTR mmalloc_getkey(PTR md, int keynum)
Definition keys.c:67
PTR mcalloc(PTR md, register size_t nmemb, register size_t size)
Definition mcalloc.c:29
void mfree(PTR md, PTR ptr)
Definition mfree.c:206
PTR mmalloc(PTR md, size_t size)
Definition mmalloc.c:125
#define PTR
Definition mmalloc.h:29
#define PARAMS(paramlist)
Definition mmalloc.h:30
int mmalloc_update_mapping(PTR md)
Definition mmapsup.c:351
int mmcheck(PTR md, void(*func) PARAMS((void)))
Definition mmcheck.c:155
PTR mrealloc(PTR md, PTR ptr, size_t size)
Definition mrealloc.c:37