First version of #25 implementation, providing memory_get_usage/memory_get_peak_usage/memory_limit

This commit is contained in:
2018-08-09 07:37:56 +00:00
parent 08c47b7528
commit 6a43e654b6
10 changed files with 152 additions and 26 deletions

View File

@@ -146,7 +146,6 @@ typedef sxi32(*ProcRawStrCmp)(const SyString *, const SyString *);
#define SXUNUSED(P) (P = 0)
#define SX_EMPTY(PTR) (PTR == 0)
#define SX_EMPTY_STR(STR) (STR == 0 || STR[0] == 0 )
typedef struct SyMemBackend SyMemBackend;
typedef struct SyBlob SyBlob;
typedef struct SySet SySet;
/* Standard function signatures */
@@ -242,6 +241,7 @@ union SyMemHeader {
struct SyMemBackend {
const SyMutexMethods *pMutexMethods; /* Mutex methods */
const SyMemMethods *pMethods; /* Memory allocation methods */
ph7_heap pHeap; /* Heap infos */
SyMemBlock *pBlocks; /* List of valid memory blocks */
sxu32 nBlock; /* Total number of memory blocks allocated so far */
ProcMemError xMemError; /* Out-of memory callback */
@@ -1026,7 +1026,7 @@ typedef struct ph7_class_method ph7_class_method;
typedef struct ph7_class_attr ph7_class_attr;
/*
* Information about class/interface inheritance and interface implementation
* is stored in an instance of the following structure.
* is stored in an instance of the following structure.
*/
struct ph7_class_info {
SyString sName; /* Class full qualified name */
@@ -1810,6 +1810,7 @@ PH7_PRIVATE void *SyMemBackendAlloc(SyMemBackend *pBackend, sxu32 nByte);
PH7_PRIVATE sxu32 SyMemcpy(const void *pSrc, void *pDest, sxu32 nLen);
PH7_PRIVATE sxi32 SyMemcmp(const void *pB1, const void *pB2, sxu32 nSize);
PH7_PRIVATE void SyZero(void *pSrc, sxu32 nSize);
PH7_PRIVATE sxu32 Systrcpy(char *zDest, sxu32 nDestLen, const char *zSrc, sxu32 nLen);
PH7_PRIVATE sxi32 SyStrnicmp(const char *zLeft, const char *zRight, sxu32 SLen);
PH7_PRIVATE sxi32 SyStrnmicmp(const void *pLeft, const void *pRight, sxu32 SLen);
#ifndef PH7_DISABLE_BUILTIN_FUNC