Skip to content

Unused tile geometry isn't deleted which leads to VRAM issues #1608

@levndev

Description

@levndev

In the tile reader there is a map that keeps tiles alive to reuse their geometry, saving VRAM, but because of the ref_ptr those tiles are never deleted which overtime leads to VRAM filling completely in certain conditions, for example when an elevation layer is used.

So far changing

mutable std::map<dvec4, ref_ptr<VertexIndexDraw>> _geometryMap;

to

mutable std::map<dvec4, observer_ptr<VertexIndexDraw>> _geometryMap;

and adding a check for null in tile::createECEFTile:

    // check if reusable geometry exists already
    {
        std::scoped_lock<std::mutex> lock(_geometryMapMutex);
        if (auto itr = _geometryMap.find(geometryKey); itr != _geometryMap.end())
        {
            if (itr->second)
                vid = itr->second;
        }
    };

seemingly solves the problem with no observable side effects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions