|
void | CheckAllocationAllowed (size_t requested_size) |
| Checks whether an allocation is allowed by the memory limit set for the script.
|
|
void * | DoAlloc (SQUnsignedInteger requested_size) |
| Internal helper to allocate the given amount of bytes.
|
|
|
std::allocator< uint8_t > | allocator |
|
size_t | allocated_size = 0 |
| Sum of allocated data size.
|
|
size_t | allocation_limit |
| Maximum this allocator may use before allocations fail.
|
|
bool | error_thrown = false |
| Whether the error has already been thrown, so to not throw secondary errors in the handling of the allocation error.
|
|
|
static const size_t | SAFE_LIMIT = 0x8000000 |
| 128 MiB, a safe choice for almost any situation
|
|
Definition at line 30 of file squirrel.cpp.
◆ ScriptAllocator()
ScriptAllocator::ScriptAllocator |
( |
| ) |
|
|
inline |
◆ ~ScriptAllocator()
ScriptAllocator::~ScriptAllocator |
( |
| ) |
|
|
inline |
◆ CheckAllocationAllowed()
void ScriptAllocator::CheckAllocationAllowed |
( |
size_t |
requested_size | ) |
|
|
inlineprivate |
Checks whether an allocation is allowed by the memory limit set for the script.
- Parameters
-
requested_size | The requested size that was requested to be allocated. |
- Exceptions
-
Script_FatalError | When memory may not be allocated (limit reached, except for error handling). |
Definition at line 54 of file squirrel.cpp.
References allocation_limit.
◆ CheckLimit()
void ScriptAllocator::CheckLimit |
( |
| ) |
const |
|
inline |
◆ DoAlloc()
void * ScriptAllocator::DoAlloc |
( |
SQUnsignedInteger |
requested_size | ) |
|
|
inlineprivate |
Internal helper to allocate the given amount of bytes.
- Parameters
-
requested_size | The requested size. |
- Returns
- The allocated memory.
- Exceptions
-
Definition at line 74 of file squirrel.cpp.
◆ Free()
void ScriptAllocator::Free |
( |
void * |
p, |
|
|
SQUnsignedInteger |
size |
|
) |
| |
|
inline |
◆ GetAllocatedSize()
size_t ScriptAllocator::GetAllocatedSize |
( |
| ) |
const |
|
inline |
◆ Malloc()
void * ScriptAllocator::Malloc |
( |
SQUnsignedInteger |
size | ) |
|
|
inline |
◆ Realloc()
void * ScriptAllocator::Realloc |
( |
void * |
p, |
|
|
SQUnsignedInteger |
oldsize, |
|
|
SQUnsignedInteger |
size |
|
) |
| |
|
inline |
◆ Reset()
void ScriptAllocator::Reset |
( |
| ) |
|
|
inline |
◆ allocated_size
size_t ScriptAllocator::allocated_size = 0 |
|
private |
Sum of allocated data size.
Definition at line 33 of file squirrel.cpp.
◆ allocation_limit
size_t ScriptAllocator::allocation_limit |
|
private |
◆ allocator
std::allocator<uint8_t> ScriptAllocator::allocator |
|
private |
◆ error_thrown
bool ScriptAllocator::error_thrown = false |
|
private |
Whether the error has already been thrown, so to not throw secondary errors in the handling of the allocation error.
This as the handling of the error will throw a Squirrel error so the Squirrel stack can be dumped, however that gets allocated by this allocator and then you might end up in an infinite loop.
Definition at line 41 of file squirrel.cpp.
◆ SAFE_LIMIT
const size_t ScriptAllocator::SAFE_LIMIT = 0x8000000 |
|
staticprivate |
128 MiB, a safe choice for almost any situation
Definition at line 43 of file squirrel.cpp.
The documentation for this struct was generated from the following file: