1.1 --- a/memory_preallocated.cc Sat Mar 20 17:05:31 2021 +0100
1.2 +++ b/memory_preallocated.cc Sat Mar 20 22:56:43 2021 +0100
1.3 @@ -38,6 +38,15 @@
1.4 delete *it;
1.5 }
1.6
1.7 +/* Return whether memory has been allocated. */
1.8 +
1.9 +bool MemoryPreallocated::allocated()
1.10 +{
1.11 + std::lock_guard<std::mutex> guard(_lock);
1.12 +
1.13 + return !(_free.empty() && _used.empty());
1.14 +}
1.15 +
1.16 /* Allocate a new region of the configured size rounded to the nearest page. */
1.17
1.18 Region *MemoryPreallocated::region()
2.1 --- a/memory_preallocated.h Sat Mar 20 17:05:31 2021 +0100
2.2 +++ b/memory_preallocated.h Sat Mar 20 22:56:43 2021 +0100
2.3 @@ -21,6 +21,8 @@
2.4
2.5 virtual ~MemoryPreallocated();
2.6
2.7 + virtual bool allocated();
2.8 +
2.9 virtual Region *region();
2.10
2.11 virtual void release(Region *region);