xo-alloc: retire redline-memory feature
This commit is contained in:
parent
13f4fb0935
commit
2048de70f3
9 changed files with 111 additions and 11 deletions
|
|
@ -42,7 +42,9 @@ namespace xo {
|
|||
* with reserved capacity @p redline_z.
|
||||
**/
|
||||
static up<ArenaAlloc> make(const std::string & name,
|
||||
#ifdef REDLINE_MEMORY
|
||||
std::size_t redline_z,
|
||||
#endif
|
||||
std::size_t z,
|
||||
bool debug_flag);
|
||||
|
||||
|
|
@ -66,10 +68,16 @@ namespace xo {
|
|||
virtual void clear() final override;
|
||||
virtual void checkpoint() final override;
|
||||
virtual std::byte * alloc(std::size_t z) final override;
|
||||
#ifdef REDLINE_MEMORY
|
||||
virtual void release_redline_memory() final override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
ArenaAlloc(const std::string & name, std::size_t rz, std::size_t z, bool debug_flag);
|
||||
ArenaAlloc(const std::string & name,
|
||||
#ifdef REDLINE_MEMORY
|
||||
std::size_t rz,
|
||||
#endif
|
||||
std::size_t z, bool debug_flag);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
@ -91,8 +99,10 @@ namespace xo {
|
|||
std::byte * free_ptr_ = nullptr;
|
||||
/** soft limit: end of released memory **/
|
||||
std::byte * limit_ = nullptr;
|
||||
#ifdef REDLINE_MEMORY
|
||||
/** amount of last-resort memory to reserve **/
|
||||
std::size_t redline_z_ = 0;
|
||||
#endif
|
||||
/** hard limit: end of allocated memory **/
|
||||
std::byte * hi_ = nullptr;
|
||||
/** true to enable detailed debug logging **/
|
||||
|
|
|
|||
|
|
@ -194,7 +194,9 @@ namespace xo {
|
|||
virtual std::byte * alloc(std::size_t z) final override;
|
||||
virtual std::byte * alloc_gc_copy(std::size_t z, const void * src) final override;
|
||||
|
||||
#ifdef REDLINE_MEMORY
|
||||
virtual void release_redline_memory() final override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
/** begin GC now **/
|
||||
|
|
|
|||
|
|
@ -76,8 +76,10 @@ namespace xo {
|
|||
* Only used in @ref GC. Default implementation asserts and returns nullptr
|
||||
**/
|
||||
virtual std::byte * alloc_gc_copy(std::size_t z, const void * src);
|
||||
#ifdef REDLINE_MEMORY
|
||||
/** release last-resort reserved memory **/
|
||||
virtual void release_redline_memory() = 0;
|
||||
#endif
|
||||
};
|
||||
} /*namespace gc*/
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,9 @@ namespace xo {
|
|||
ListAlloc(std::unique_ptr<ArenaAlloc> hd,
|
||||
ArenaAlloc * marked,
|
||||
std::size_t cz, std::size_t nz, std::size_t tz,
|
||||
#ifdef REDLINE_MEMORY
|
||||
bool use_redline,
|
||||
#endif
|
||||
bool debug_flag);
|
||||
~ListAlloc();
|
||||
|
||||
|
|
@ -66,7 +68,9 @@ namespace xo {
|
|||
virtual void clear() final override;
|
||||
virtual void checkpoint() final override;
|
||||
virtual std::byte * alloc(std::size_t z) final override;
|
||||
#ifdef REDLINE_MEMORY
|
||||
virtual void release_redline_memory() final override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
/** **/
|
||||
|
|
@ -79,11 +83,16 @@ namespace xo {
|
|||
* from trying to converge on app working set size
|
||||
**/
|
||||
std::list<std::unique_ptr<ArenaAlloc>> full_l_;
|
||||
std::size_t current_z_ = 0;;
|
||||
std::size_t next_z_ = 0;;
|
||||
/** size of current arena @ref hd_ **/
|
||||
std::size_t current_z_ = 0;
|
||||
/** if @ref hd_ fills, size of next arena to allocate **/
|
||||
std::size_t next_z_ = 0;
|
||||
/** total size of @ref hd_ + contents of @ref full_l_ **/
|
||||
std::size_t total_z_ = 0;
|
||||
#ifdef REDLINE_MEMORY
|
||||
bool use_redline_ = false;
|
||||
bool redlined_flag_ = false;
|
||||
#endif
|
||||
|
||||
/** true to enable debug logging **/
|
||||
bool debug_flag_ = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue