xref: /netbsd-src/external/gpl3/binutils.old/dist/gprofng/libcollector/memmgr.h (revision c42dbd0ed2e61fe6eda8590caa852ccf34719964)
1 /* Copyright (C) 2021 Free Software Foundation, Inc.
2    Contributed by Oracle.
3 
4    This file is part of GNU Binutils.
5 
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3, or (at your option)
9    any later version.
10 
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, 51 Franklin Street - Fifth Floor, Boston,
19    MA 02110-1301, USA.  */
20 
21 #ifndef _MEMMGR_H
22 #define _MEMMGR_H
23 
24 struct Heap;
25 typedef struct Heap Heap;
26 
27 Heap *__collector_newHeap ();
28 void __collector_deleteHeap (Heap *heap);
29 
30 /*
31  * Initialize memmgr mutex locks.
32  */
33 void __collector_mmgr_init_mutex_locks (Heap *heap);
34 
35 /*
36  * Allocate non-resizable memory.
37  */
38 void *__collector_allocCSize (Heap *heap, unsigned sz, int log);
39 
40 /*
41  * Free non-resizable memory.
42  */
43 void __collector_freeCSize (Heap *heap, void *ptr, unsigned sz);
44 
45 /*
46  * Allocate resizable memory
47  */
48 void *__collector_allocVSize (Heap *heap, unsigned sz);
49 
50 /*
51  * Change size of resizable memory.
52  * ptr - if not NULL, it must have been previously allocated from
53  *       the same heap, otherwise returns allocVSize(heap, newsz);
54  * newsz - new size; if 0, memory is freed and no new allocation
55  *       occurs;
56  */
57 void *__collector_reallocVSize (Heap *heap, void *ptr, unsigned newsz);
58 
59 #endif
60