diff options
| author | Jeff Epler <jepler@gmail.com> | 2020-04-01 11:59:15 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2020-04-14 18:24:58 -0500 |
| commit | 3a94412cd35c39bf30f29cb2b79be3870709c809 (patch) | |
| tree | 8a2653aa8a7ca665f0f70b74172cc964d33504b2 /shared-module/_protomatter/allocator.h | |
| parent | 1d8a073c05c36133e02d839ed187b9d7abf24d79 (diff) | |
protomatter: more memory allocation fixes
- bump supervisor alloc count by 4 (we actually use 5)
- move reconstruct to after gc heap is reset
- destroy protomatter object entirely if not used by a FramebufferDisplay
- ensure previous supervisor allocations are released
- zero out pointers so GC can collect them
Diffstat (limited to 'shared-module/_protomatter/allocator.h')
| -rw-r--r-- | shared-module/_protomatter/allocator.h | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/shared-module/_protomatter/allocator.h b/shared-module/_protomatter/allocator.h index 8d9d7ff96..9b7590df3 100644 --- a/shared-module/_protomatter/allocator.h +++ b/shared-module/_protomatter/allocator.h @@ -6,7 +6,7 @@ #include "supervisor/memory.h" #define _PM_ALLOCATOR _PM_allocator_impl -#define _PM_FREE _PM_free_impl +#define _PM_FREE(x) (_PM_free_impl((x)), (x)=NULL, (void)0) static inline void *_PM_allocator_impl(size_t sz) { supervisor_allocation *allocation = allocate_memory(align32_size(sz), true); @@ -22,8 +22,6 @@ static inline void _PM_free_impl(void *ptr_in) { if (allocation) { free_memory(allocation); - } else { - m_free(ptr_in); } } |
