Skip to content

Improve ObjectPool memory tracking #205

Open
@johnhaddon

Description

@johnhaddon

The current mechanism for tracking memory usage in an ObjectPool is rather simplistic, simply adding Object::memoryUsage() to the total when adding an object and subtracting it when removing an object.

In reality, many objects share the same child objects, so we are overcounting our memory usage, and therefore removing objects from the pool in unnecessary attempt to keep below memory limits. We should fix this.

Note that when counting the memory for an individual object with Object::memoryUsage, we already have an awareness of when the same child object is referenced twice, and don't overcount there, using the Object::MemoryAccumulator class - I suspect we could use a persistent version of something like this class inside the ObjectPool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreIssues with core Cortex functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions