not possible to use *VmError* due to use of SyString abd backend memory, using as sapi helpers puts ...

This commit is contained in:
David Carlier 2018-08-13 12:20:07 +01:00
parent 6bac05a057
commit eef673576f

View File

@ -89,11 +89,9 @@ PH7_PRIVATE sxu32 SyMemcpy(const void *pSrc, void *pDest, sxu32 nLen) {
#define CheckHeap(BACKEND, BYTES)\
if(BACKEND->pHeap.iMax && BACKEND->pHeap.nBytes + BYTES > BACKEND->pHeap.iMax) {\
if(BACKEND->xMemError) {\
char buf[256] = {0};\
snprintf(buf, sizeof(buf) - 1, "Out of memory, max allowed %llu bytes, allocated %llu bytes\n", BACKEND->pHeap.iMax, BACKEND->pHeap.nBytes);\
BACKEND->xMemError(buf);\
}\
char buf[256];\
snprintf(buf, sizeof(buf) - 1, "Out of memory, max allowed %llu bytes, allocated %llu bytes\n", BACKEND->pHeap.iMax, BACKEND->pHeap.nBytes);\
puts(buf);\
PH7_VmRelease(BACKEND->pHeap.pVm);\
exit(255);\
}\
@ -129,9 +127,6 @@ static void *MemOSRealloc(void *pOld, sxu32 nBytes, SyMemBackend *pBackend) {
return 0;
}
pChunk[0] = nBytes;
if(pOldChunk) {
pBytes -= pBackend->pMethods->xChunkSize(pOldChunk);
}
AddToHeap(pBackend, pBytes);
return (void *)&pChunk[1];
}