/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to libssts/mm.h

  • Committer: Gustav Hartvigsson
  • Date: 2016-02-08 13:24:17 UTC
  • mto: This revision was merged to the branch mainline in revision 131.
  • Revision ID: gustav.hartvigsson@gmail.com-20160208132417-sajh652luiz0mfia
* pragma once gawd damn it!
* License.
* skeleton.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#pragma once
2
2
 
 
3
/*
 
4
Copyright (c) 2013-2016 Gustav Hartvigsson
 
5
 
 
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:
 
12
 
 
13
The above copyright notice and this permission notice shall be included in
 
14
all copies or substantial portions of the Software.
 
15
 
 
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
 
22
THE SOFTWARE.
 
23
 */
 
24
 
3
25
#include "defs.h"
4
26
 
5
27
#if USE_GC
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.
25
47
 *
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.
28
50
 *
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. */
46
68
} SMMType;
47
69
 
48
70
/**
53
75
  "NONE",
54
76
  "libc",
55
77
  "GC",
56
 
  "Mark and Wipe",
 
78
  "Mark and Sweep",
57
79
  0x0,
58
80
  0x0
59
81
};
97
119
/**
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.
 
122
 *
 
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.
100
125
 */
101
126
void
102
127
s_free (spointer pointer);