Make LowMemoryNotification object allocated (#281)

* Make LowMemoryNotification object allocated

This makes a separate allocation for the callback object.  This makes
it easier for different callbacks to be used.

* Add reserve_with_leftover to address_space

The address_space now supports reserving for non-power of 2 allocations
and the space that is used for rounding up is retained by the
address_space.  This means that we can more tightly pack the allocators
internal objects.
This commit is contained in:
Matthew Parkinson
2021-02-23 14:51:44 +00:00
committed by GitHub
parent c082a331e2
commit 8840b386bc
4 changed files with 66 additions and 17 deletions

View File

@@ -70,9 +70,13 @@ namespace snmalloc
*/
struct PalNotificationObject
{
std::atomic<PalNotificationObject*> pal_next;
std::atomic<PalNotificationObject*> pal_next = nullptr;
void (*pal_notify)(PalNotificationObject* self);
PalNotificationObject(void (*pal_notify)(PalNotificationObject* self))
: pal_notify(pal_notify)
{}
};
/***