Add sane default memory hook to Cytoplasm, fix more leaks in json.

This commit is contained in:
Jordan Bancino 2023-05-23 22:43:37 +00:00
parent 4b85d10983
commit 061d9df739
4 changed files with 73 additions and 2 deletions

View file

@ -199,6 +199,15 @@ extern void MemoryIterate(void (*) (MemoryInfo *, void *), void *);
*/
extern void MemoryHook(void (*) (MemoryAction, MemoryInfo *, void *), void *);
/**
* The default memory hook, which has sane behavior and is installed
* at runtime. This function does not use any memory on the heap,
* except for the MemoryInfo passed to it, which it assumes to be
* valid. Everything else happens on the stack only, to ensure that
* the hook doesn't make any memory problems worse.
*/
extern void MemoryDefaultHook(MemoryAction, MemoryInfo *, void *);
/**
* Read over the block of memory represented by the given memory info
* structure and generate a hexadecimal and ASCII string for each