TinySTM  1.0.5
mod_mem.h
Go to the documentation of this file.
1 /*
2  * File:
3  * mod_mem.h
4  * Author(s):
5  * Pascal Felber <pascal.felber@unine.ch>
6  * Patrick Marlier <patrick.marlier@unine.ch>
7  * Description:
8  * Module for dynamic memory management.
9  *
10  * Copyright (c) 2007-2014.
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation, version 2
15  * of the License.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * This program has a dual license and can also be distributed
23  * under the terms of the MIT license.
24  */
25 
40 #ifndef _MOD_MEM_H_
41 # define _MOD_MEM_H_
42 
43 # include "stm.h"
44 
45 # ifdef __cplusplus
46 extern "C" {
47 # endif
48 
50 
59 void *stm_malloc(size_t size);
60 void *stm_malloc_tx(struct stm_tx *tx, size_t size);
62 
64 
75 void *stm_calloc(size_t nm, size_t size);
76 void *stm_calloc_tx(struct stm_tx *tx, size_t nm, size_t size);
78 
80 
92 void stm_free(void *addr, size_t size);
93 void stm_free_tx(struct stm_tx *tx, void *addr, size_t size);
95 
97 
111 void stm_free2(void *addr, size_t idx, size_t size);
112 void stm_free2_tx(struct stm_tx *tx, void *addr, size_t idx, size_t size);
114 
124 void mod_mem_init(int gc);
125 
126 # ifdef __cplusplus
127 }
128 # endif
129 
130 #endif /* _MOD_MEM_H_ */