Class do easily allocate/deallocate memory in Torch.
Public Methods
-
Allocator()
- Create a new allocator
-
void* alloc(size_t size, int object_style=0)
- Returns size bytes of allocated memory.
-
void* realloc(void* ptr, size_t size)
- Reallocate a part of the memory which has been already allocated with alloc (and object_style=0).
-
void free(void* ptr)
- Force given pointer to memory to be freed now.
-
void retain(void* ptr, int object_style=0)
- Tells to the allocator that it should handle the memory given by ptr.
-
int release(void* ptr)
- Tells to the allocator to stop taking in account the memory given by ptr.
-
void steal(void* ptr, Allocator* allocator)
- Handles the memory given by ptr which was previouly handled by allocator.
-
void steal(Allocator* allocator)
- Steals all pointers contained in allocator
-
AllocatorNode* isMine(void* ptr)
- Returns true iff ptr is handled by the allocator
-
void freeAll()
- Force all pointers contained in the allocator to be freed now.
-
static void* sysAlloc(int size)
- System allocation.
-
static void* sysRealloc(void* ptr, int size)
- System reallocation.
Documentation
Class do easily allocate/deallocate memory in Torch.
The memory allocated by an allocator will be destroyed
when the allocator will be destroyed.
- Allocator()
- Create a new allocator
- void* alloc(size_t size, int object_style=0)
- Returns size bytes of allocated memory.
- If object_style is 0, the allocated memory is
considered as if it wasn't for an object. At the destruction
of the allocator the memory will be freed, and that's all.
- If 1, the Object destructor will be called
at the destruction and the memory will be freed.
- If 2, the destructor will be called, but the memory
won't be freed.
- void* realloc(void* ptr, size_t size)
- Reallocate a part of the memory which has been already
allocated with alloc (and object_style=0).
Same behaviour as the realloc() system function.
- void free(void* ptr)
- Force given pointer to memory to be freed now.
It considers the object_style given by alloc()
and calls the Object destructor, if needed.
- void retain(void* ptr, int object_style=0)
- Tells to the allocator that it should handle the memory
given by ptr. Take in account the object_style.
- int release(void* ptr)
- Tells to the allocator to stop taking in account the
memory given by ptr. The memory will not be released.
- void steal(void* ptr, Allocator* allocator)
- Handles the memory given by ptr which was previouly
handled by allocator. allocator looses the control
of this memory
- void steal(Allocator* allocator)
- Steals all pointers contained in allocator
- AllocatorNode* isMine(void* ptr)
- Returns true iff ptr is handled by the allocator
- void freeAll()
- Force all pointers contained in the allocator to be freed now.
It considers the object_style given by alloc()
and calls the Object destructor, if needed.
- static void* sysAlloc(int size)
- System allocation.
As system malloc function, but do an error if there is no more memory.
- static void* sysRealloc(void* ptr, int size)
- System reallocation.
As system realloc function, but do an error if there is no more memory.
- This class has no child classes.
- Author:
- Ronan Collobert (collober@idiap.ch)
- See Also:
- Object
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.