This is a new memory subsystem implementing heap calculations as well as new builtin functions: * get_memory_usage() * get_memory_peak_usage() * get_memory_limit() It also allows to set an upper memory limit, ensuring that processed script will not be able to allocate more memory from OS. New subsystem is based on work done in 'memory_limit' branch. Big thanks to devnexen! This finally fixes #25.
This commit is contained in:
@@ -249,7 +249,7 @@ struct SyMemMethods {
|
||||
void *(*xAlloc)(unsigned int); /* [Required:] Allocate a memory chunk */
|
||||
void *(*xRealloc)(void *, unsigned int); /* [Required:] Re-allocate a memory chunk */
|
||||
void (*xFree)(void *); /* [Required:] Release a memory chunk */
|
||||
unsigned int (*xChunkSize)(void *); /* [Optional:] Return chunk size */
|
||||
unsigned int (*xChunkSize)(void *); /* [Required:] Return chunk size */
|
||||
int (*xInit)(void *); /* [Optional:] Initialization callback */
|
||||
void (*xRelease)(void *); /* [Optional:] Release callback */
|
||||
void *pUserData; /* [Optional:] First argument to xInit() and xRelease() */
|
||||
@@ -351,6 +351,7 @@ typedef sxi64 ph7_int64;
|
||||
#define PH7_CONFIG_ERR_OUTPUT 1 /* TWO ARGUMENTS: int (*xConsumer)(const void *pOut,unsigned int nLen,void *pUserData),void *pUserData */
|
||||
#define PH7_CONFIG_ERR_ABORT 2 /* RESERVED FOR FUTURE USE */
|
||||
#define PH7_CONFIG_ERR_LOG 3 /* TWO ARGUMENTS: const char **pzBuf,int *pLen */
|
||||
#define PH7_CONFIG_MEM_LIMIT 4 /* ONE ARGUMENT: char *nMemLimit */
|
||||
/*
|
||||
* Virtual Machine Configuration Commands.
|
||||
*
|
||||
|
Reference in New Issue
Block a user