Changeset View
Changeset View
Standalone View
Standalone View
intern/guardedalloc/MEM_guardedalloc.h
| Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
| #define __MEM_GUARDEDALLOC_H__ | #define __MEM_GUARDEDALLOC_H__ | ||||
| #include <stdio.h> /* needed for FILE* */ | #include <stdio.h> /* needed for FILE* */ | ||||
| /* needed for uintptr_t and attributes, exception, dont use BLI anywhere else in MEM_* */ | /* needed for uintptr_t and attributes, exception, dont use BLI anywhere else in MEM_* */ | ||||
| #include "../../source/blender/blenlib/BLI_sys_types.h" | #include "../../source/blender/blenlib/BLI_sys_types.h" | ||||
| #include "../../source/blender/blenlib/BLI_compiler_attrs.h" | #include "../../source/blender/blenlib/BLI_compiler_attrs.h" | ||||
| #include <sys/types.h> | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| extern "C" { | extern "C" { | ||||
| #endif | #endif | ||||
| /** Returns the length of the allocated memory segment pointed at | /** Returns the length of the allocated memory segment pointed at | ||||
| * by vmemh. If the pointer was not previously allocated by this | * by vmemh. If the pointer was not previously allocated by this | ||||
| * module, the result is undefined.*/ | * module, the result is undefined.*/ | ||||
| extern size_t (*MEM_allocN_len)(const void *vmemh) ATTR_WARN_UNUSED_RESULT; | extern size_t (*MEM_allocN_len)(const void *vmemh) ATTR_WARN_UNUSED_RESULT; | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | #define MEM_recallocN(vmemh, len) MEM_recallocN_id(vmemh, len, __func__) | ||||
| extern void *(*MEM_mallocN_aligned)(size_t len, size_t alignment, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(3); | extern void *(*MEM_mallocN_aligned)(size_t len, size_t alignment, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(3); | ||||
| /** | /** | ||||
| * Same as callocN, clears memory and uses mmap (disk cached) if supported. | * Same as callocN, clears memory and uses mmap (disk cached) if supported. | ||||
| * Can be free'd with MEM_freeN as usual. | * Can be free'd with MEM_freeN as usual. | ||||
| * */ | * */ | ||||
| extern void *(*MEM_mapallocN)(size_t len, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2); | extern void *(*MEM_mapallocN)(size_t len, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2); | ||||
| /** | |||||
| * Wrappers around 'real' mmap/munmap, because on windows we have to take care of thread safety ourselves. | |||||
| */ | |||||
| extern void *(*MEM_mmap)(void *start, size_t len, int prot, int flags, int fd, off_t offset); | |||||
| extern int (*MEM_munmap)(void *ptr, size_t size); | |||||
| /** Print a list of the names and sizes of all allocated memory | /** Print a list of the names and sizes of all allocated memory | ||||
| * blocks. as a python dict for easy investigation */ | * blocks. as a python dict for easy investigation */ | ||||
| extern void (*MEM_printmemlist_pydict)(void); | extern void (*MEM_printmemlist_pydict)(void); | ||||
| /** Print a list of the names and sizes of all allocated memory | /** Print a list of the names and sizes of all allocated memory | ||||
| * blocks. */ | * blocks. */ | ||||
| extern void (*MEM_printmemlist)(void); | extern void (*MEM_printmemlist)(void); | ||||
| ▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines | |||||