source: src/examples/gc_no_raii/src/allocate-pool.c @ 29ad0ac

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 29ad0ac was d67a9a1, checked in by Thierry Delisle <tdelisle@…>, 9 years ago

pool alloc functional

  • Property mode set to 100644
File size: 1.3 KB
Line 
1#define _BSD_SOURCE /* for MAP_ANON */
2#define _DARWIN_C_SOURCE /* for MAP_ANON on OS X */
3
4
5/* for standards info */
6#if defined(unix) || defined(__unix) || defined(__unix__) || \
7    (defined(__APPLE__) && defined(__MACH__))
8#include <unistd.h>
9#endif
10
11#if defined(_WIN32)
12#ifndef WIN32_LEAN_AND_MEAN
13#define WIN32_LEAN_AND_MEAN
14#endif
15#include <windows.h>
16#endif
17
18#include <errno.h>
19#include <stdlib.h>
20#include <stdio.h>
21#include <string.h>
22#include <sys/types.h>
23
24#if _POSIX_VERSION
25#include <sys/mman.h>
26#endif
27
28#ifdef CFA
29extern "C"{
30#endif
31
32/* figure out which allocator to use */
33#if defined(GGGGC_USE_MALLOC)
34#define GGGGC_ALLOCATOR_MALLOC 1
35#include "../pool-alloc/allocate-malloc.c"
36
37#elif _POSIX_ADVISORY_INFO >= 200112L
38#define GGGGC_ALLOCATOR_POSIX_MEMALIGN 1
39#include "../pool-alloc/allocate-malign.c"
40
41#elif defined(MAP_ANON)
42#define GGGGC_ALLOCATOR_MMAP 1
43#include "../pool-alloc/allocate-mmap.c"
44
45#elif defined(_WIN32)
46#define GGGGC_ALLOCATOR_VIRTUALALLOC 1
47#include "../pool-alloc/allocate-win-valloc.c"
48
49#else
50#warning GGGGC: No allocator available other than malloc!
51#define GGGGC_ALLOCATOR_MALLOC 1
52#include "../pool-alloc/allocate-malloc.c"
53
54#endif
55
56void* pal_allocPool(size_t size, int mustSucceed)
57{
58      return allocPool(size, mustSucceed);
59}
60
61#ifdef CFA
62}
63#endif
Note: See TracBrowser for help on using the repository browser.