polar-objc 5.44
An Objective-C runtime library
Loading...
Searching...
No Matches
polar-platform-memory.c
1/* Internal API: low-level, platform-specific memory management routines for polar-objc.
2 Copyright (C) 2022-2025 Michael Malicoat <[email protected]>
3
4 This file is part of polar-objc.
5
6 polar-objc is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
8
9 polar-objc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
10 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11 details.
12
13 You should have received a copy of the GNU General Public License along with this program; see the file LICENSE. If
14 not, see <http://www.gnu.org/licenses/>.
15*/
16
17
18// Public ==============================================================================================================
19// Platform-specific code ----------------------------------------------------------------------------------------------
20
21#ifndef POLAR_USE_CUSTOM_HEAP
22 #if defined(OBJC_PLATFORM_GENERIC)
23 #include "source/polar-internals/platform/generic/polar-generic-platform-heap.c"
24 #elif defined(OBJC_PLATFORM_POSIX)
25 #include "source/polar-internals/platform/specific/posix/polar-posix-platform-heap.c"
26 #elif defined(OBJC_PLATFORM_WINDOWS)
27 #include "source/polar-internals/platform/specific/windows/polar-windows-platform-heap.c"
28 #endif // OBJC_PLATFORM_GENERIC
29#endif // !POLAR_USE_CUSTOM_HEAP
30
31#if defined(OBJC_PLATFORM_GENERIC)
32 #include "source/polar-internals/platform/generic/polar-generic-platform-vmem.c"
33#elif defined(OBJC_PLATFORM_POSIX)
34 #include "source/polar-internals/platform/specific/posix/polar-posix-platform-vmem.c"
35#elif defined(OBJC_PLATFORM_WINDOWS)
36 #include "source/polar-internals/platform/specific/windows/polar-windows-platform-vmem.c"
37#endif
38
39// Platform-agnostic code ----------------------------------------------------------------------------------------------
40
41// Called by polar_init()
42POLAR_FUNCTION_INTERNAL intptr_t
44{
45 if( polar_platform_heap_init() != 0 )
46 return -1;
47
48 if( polar_platform_vmem_init() != 0 )
49 return -1;
50
52
53 POLAR_DEBUG_FUNCTION_END;
54
55 return 0;
56}
57
61
68
78
96
110
135
155
166
183
194
213
239
intptr_t polar_platform_vmem_init(void)
Definition polar-windows-platform-vmem.c:56
size_t POLAR_PLATFORM_SIZEOF_MEMORY_PAGE
Definition polar-windows-platform-vmem.c:19
intptr_t polar_platform_memory_init(void)
Definition polar-platform-memory.c:43
intptr_t polar_platform_heap_init(void)
Definition polar-windows-platform-heap.c:50