4
Copyright (c) 2013-2016 Gustav Hartvigsson
6
Permission is hereby granted, free of charge, to any person obtaining a copy
7
of this software and associated documentation files (the "Software"), to deal
8
in the Software without restriction, including without limitation the rights
9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
copies of the Software, and to permit persons to whom the Software is
11
furnished to do so, subject to the following conditions:
13
The above copyright notice and this permission notice shall be included in
14
all copies or substantial portions of the Software.
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
45
* General rule: for every @ref s_malloc() have a @ref s_free() even if you know
24
46
* you are running a GC.
26
* The Mark and Wipe method interacts with the the mainloop, freeing the all
48
* The Mark and Sweep method interacts with the the mainloop, freeing the all
27
49
* data marked for freeing in one sweep.
29
51
* In Mark and Sweep s_free adds the pointers to a list of pointers to be freed.
42
64
S_MM_TYPE_NONE, /*< NONE, use standard. */
43
65
S_MM_TYPE_LIBC, /*< Use libc's malloc/free stuffs */
44
66
S_MM_TYPE_GC, /*< Use libgc's garbage collector. */
45
S_MM_MARK_AND_WIPE /*< Use a 'mark and wipe' style system. */
67
S_MM_MARK_AND_SWEEP /*< Use a 'mark and sweep' style system. */
98
120
* by default this acts just as a normal call to free. If GC is enabled this
99
121
* will set the pointer to NULL.
123
* In Mark and Sweep mode this will add the pointers to a list of pointers to
124
* be freed later in the loop. When this is can not be guaranteed.
102
127
s_free (spointer pointer);