-
Notifications
You must be signed in to change notification settings - Fork 0
Memory Analysis
Adds a runtime check to ensure calls to malloc succeed, and handle them "safely" if not. In essence, if a memory allocation attempt fails (malloc returns NULL), then the requested size will be printed, and if -stacktrace is used, the stack trace of the location will be reported as well.
This will add a lightweight leak sanitizer to the emitted output. It tracks statistics related to allocation count - the amount of "memory blocks" active on the heap that were requested only by North Hollywood Python's built-in features (invocations of the new keyword, etc..), not external c calls to malloc.
The reported statistics are:
- Peak allocation count
- Current allocation count These statistics may be used to detect memory leaks, by comparing the current allocation count before an operation is performed, and after it is performed.
This does everything in level 1, but in addition, tracks the magnitude of memory allocations (level 1 only tracked the count).
Additionally reported statistics include:
- Peak allocation size
- Current allocation size
Use the
mem::leaksanfunction found inmem.nhpto sanitize leaks from a certain function (must returnNone).