#include "omalloc/omConfig.h"
Go to the source code of this file.
◆ omSizeWOfLargeAddr
◆ omVallocFromSystem
◆ _omVallocFromSystem()
void * _omVallocFromSystem |
( |
size_t |
size, |
|
|
int |
fail |
|
) |
| |
Definition at line 314 of file omAllocSystem.c.
315{
318 {
319 OM_MEMORY_LOW_HOOK();
322 {
323 if (fail)
return NULL;
324 else
325 {
326 OM_OUT_OF_MEMORY_HOOK();
327
329 exit(1);
330 }
331 }
332 }
333
334#ifndef OM_NDEBUG
339#endif
340
344 {
346#if defined(OM_HAVE_VALLOC_MMAP) && defined(OM_MALLOC_MAX_BYTES_SYSTEM)
347 if (
om_Info.MaxBytesFromValloc + OM_MALLOC_MAX_BYTES_SYSTEM >
om_Info.MaxBytesSystem)
348 om_Info.MaxBytesSystem =
om_Info.MaxBytesFromValloc + OM_MALLOC_MAX_BYTES_SYSTEM;
349#endif
350#if defined(HAVE_SBRK) && !defined(OM_HAVE_VALLOC_MMAP) && !defined(OM_MALLOC_MAX_BYTES_SBRK)
353 {
356 +
om_Info.CurrentBytesFromValloc);
357 }
358#endif
359 }
360 OM_VALLOC_HOOK(
size);
361 return page;
362}
#define OM_VALLOC_FROM_SYSTEM
#define omIsAddrPageAligned(addr)
unsigned long om_SbrkInit
◆ omAlloc0Large()
void * omAlloc0Large |
( |
size_t |
size | ) |
|
Definition at line 78 of file omAllocSystem.c.
79{
81 memset(addr, 0,
size);
82 return addr;
83}
void * omAllocLarge(size_t size)
◆ omAllocFromSystem()
void * omAllocFromSystem |
( |
size_t |
size | ) |
|
Definition at line 190 of file omAllocSystem.c.
191{
192 void* ptr;
193
196 {
197 OM_MEMORY_LOW_HOOK();
200 {
201 OM_OUT_OF_MEMORY_HOOK();
202 exit(1);
203 }
204 }
205#if defined(HAVE_MALLOC_SIZE) || defined(HAVE_MALLOC_USABLE_SIZE)
207#else
209#endif
210#ifndef OM_NDEBUG
215#endif
216
219 {
221#if defined(OM_HAVE_VALLOC_MMAP) && defined(OM_MALLOC_MAX_BYTES_SYSTEM)
222 if (
om_Info.CurrentBytesFromValloc + OM_MALLOC_MAX_BYTES_SYSTEM >
om_Info.MaxBytesSystem)
223 om_Info.MaxBytesSystem =
om_Info.CurrentBytesFromValloc + OM_MALLOC_MAX_BYTES_SYSTEM;
224#endif
225#if defined(HAVE_SBRK) && !defined(OM_MALLOC_MAX_BYTES_SBRK)
228#ifndef OM_HAVE_VALLOC_MMAP
229 +
om_Info.CurrentBytesFromValloc
230#endif
232 {
234 }
235#endif
236 }
237 OM_MALLOC_HOOK(
size);
238 return ptr;
239}
size_t omSizeOfAddr(const void *addr)
#define _omSizeOfLargeAddr(addr)
#define OM_MALLOC_FROM_SYSTEM
◆ omAllocLarge()
void * omAllocLarge |
( |
size_t |
size | ) |
|
Definition at line 44 of file omAllocSystem.c.
45{
46 char* addr;
49 *((
size_t*) addr) =
size;
50 return (void *)(addr + SIZEOF_STRICT_ALIGNMENT);
51}
void * omAllocFromSystem(size_t size)
◆ omFreeLarge()
void omFreeLarge |
( |
void * |
addr | ) |
|
Definition at line 69 of file omAllocSystem.c.
70{
71 char* _addr = (char *)addr - SIZEOF_STRICT_ALIGNMENT;
73}
void omFreeSizeToSystem(void *addr, size_t size)
◆ omFreeSizeToSystem()
void omFreeSizeToSystem |
( |
void * |
addr, |
|
|
size_t |
size |
|
) |
| |
◆ omFreeToSystem()
void omFreeToSystem |
( |
void * |
addr | ) |
|
◆ omRealloc0Large()
void * omRealloc0Large |
( |
void * |
old_addr, |
|
|
size_t |
new_size |
|
) |
| |
Definition at line 85 of file omAllocSystem.c.
86{
87 size_t old_size;
88 char* new_addr;
89
91
93
96 if (new_size > old_size)
97 memset(new_addr + old_size, 0, new_size - old_size);
98 return (void *)new_addr;
99}
size_t omSizeOfLargeAddr(void *addr)
void * omReallocLarge(void *old_addr, size_t new_size)
#define omIsBinPageAddr(addr)
◆ omReallocFromSystem()
void * omReallocFromSystem |
( |
void * |
addr, |
|
|
size_t |
newsize |
|
) |
| |
Definition at line 241 of file omAllocSystem.c.
242{
244}
void * omReallocSizeFromSystem(void *addr, size_t oldsize, size_t newsize)
◆ omReallocLarge()
void * omReallocLarge |
( |
void * |
old_addr, |
|
|
size_t |
new_size |
|
) |
| |
Definition at line 53 of file omAllocSystem.c.
54{
55 char* _old_addr;
56 char* new_addr;
57
59
60 new_size = OM_ALIGN_SIZE(new_size);
61 _old_addr = (char *)old_addr - SIZEOF_STRICT_ALIGNMENT;
63 *((size_t*) _old_addr) + SIZEOF_STRICT_ALIGNMENT,
64 new_size + SIZEOF_STRICT_ALIGNMENT);
65 *((size_t*) new_addr) = new_size;
66 return (void *)(new_addr + SIZEOF_STRICT_ALIGNMENT);
67}
◆ omReallocSizeFromSystem()
void * omReallocSizeFromSystem |
( |
void * |
addr, |
|
|
size_t |
oldsize, |
|
|
size_t |
newsize |
|
) |
| |
Definition at line 246 of file omAllocSystem.c.
247{
249
250
253 {
254 OM_MEMORY_LOW_HOOK();
255
256
257
260 {
261 OM_OUT_OF_MEMORY_HOOK();
262
264 exit(1);
265 }
266 }
267
268
269#ifndef OM_NDEBUG
274#endif
275
276 om_Info.CurrentBytesFromMalloc += (long) newsize - (
long) oldsize;
277
278
280 {
282#if defined(OM_HAVE_VALLOC_MMAP) && defined(OM_MALLOC_MAX_BYTES_SYSTEM)
283 if (
om_Info.CurrentBytesFromValloc + OM_MALLOC_MAX_BYTES_SYSTEM >
om_Info.MaxBytesSystem)
284 om_Info.MaxBytesSystem =
om_Info.CurrentBytesFromValloc + OM_MALLOC_MAX_BYTES_SYSTEM;
285#endif
286#if defined(HAVE_SBRK) && !defined(OM_MALLOC_MAX_BYTES_SBRK)
288#ifndef OM_HAVE_VALLOC_MMAP
289 +
om_Info.CurrentBytesFromValloc
290#endif
292 {
294 }
295#endif
296 }
297
298 OM_REALLOC_HOOK(oldsize, newsize);
300}
#define OM_REALLOC_FROM_SYSTEM
◆ omSizeOfAddr()
size_t omSizeOfAddr |
( |
const void * |
addr | ) |
|
Definition at line 106 of file omAllocSystem.c.
107{
108
109
111#ifdef OM_HAVE_TRACK
113#else
115#endif
117}
#define omSizeOfBinAddr(addr)
#define omIsBinAddrTrackAddr(addr)
◆ omSizeOfLargeAddr()
size_t omSizeOfLargeAddr |
( |
void * |
addr | ) |
|
◆ omSizeWOfAddr()
size_t omSizeWOfAddr |
( |
void * |
addr | ) |
|
Definition at line 119 of file omAllocSystem.c.
120{
121
123#ifdef OM_HAVE_TRACK
125#else
127#endif
129}
#define omSizeWOfBinAddr(addr)
◆ omVfreeToSystem()
void omVfreeToSystem |
( |
void * |
page, |
|
|
size_t |
size |
|
) |
| |