/usr/include/TH/THAllocator.h is in libtorch-th-dev 0~20170926-g89ede3b-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #ifndef TH_ALLOCATOR_INC
#define TH_ALLOCATOR_INC
#include "THGeneral.h"
#define TH_ALLOCATOR_MAPPED_SHARED 1
#define TH_ALLOCATOR_MAPPED_SHAREDMEM 2
#define TH_ALLOCATOR_MAPPED_EXCLUSIVE 4
#define TH_ALLOCATOR_MAPPED_NOCREATE 8
#define TH_ALLOCATOR_MAPPED_KEEPFD 16
#define TH_ALLOCATOR_MAPPED_FROMFD 32
#define TH_ALLOCATOR_MAPPED_UNLINK 64
/* Custom allocator
*/
typedef struct THAllocator {
void* (*malloc)(void*, ptrdiff_t);
void* (*realloc)(void*, void*, ptrdiff_t);
void (*free)(void*, void*);
} THAllocator;
/* default malloc/free allocator. malloc and realloc raise an error (using
* THError) on allocation failure.
*/
extern THAllocator THDefaultAllocator;
/* file map allocator
*/
typedef struct THMapAllocatorContext_ THMapAllocatorContext;
TH_API THMapAllocatorContext *THMapAllocatorContext_new(const char *filename, int flags);
TH_API THMapAllocatorContext *THMapAllocatorContext_newWithFd(const char *filename,
int fd, int flags);
TH_API char * THMapAllocatorContext_filename(THMapAllocatorContext *ctx);
TH_API int THMapAllocatorContext_fd(THMapAllocatorContext *ctx);
TH_API ptrdiff_t THMapAllocatorContext_size(THMapAllocatorContext *ctx);
TH_API void THMapAllocatorContext_free(THMapAllocatorContext *ctx);
TH_API void THRefcountedMapAllocator_incref(THMapAllocatorContext *ctx, void *data);
TH_API int THRefcountedMapAllocator_decref(THMapAllocatorContext *ctx, void *data);
extern THAllocator THMapAllocator;
extern THAllocator THRefcountedMapAllocator;
#endif
|