Skip to content

Commit

Permalink
BVHAggregate: add shrink_to_fit() call after resize(0)
Browse files Browse the repository at this point in the history
So it turns out this is necessary to actually free the memory...
Via Keith Jeffery.
  • Loading branch information
mmp committed Jan 25, 2024
1 parent 5acc5e4 commit eb1d4ca
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/pbrt/cpu/aggregates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ BVHAggregate::BVHAggregate(std::vector<Primitive> prims, int maxPrimsInNode,

// Convert BVH into compact representation in _nodes_ array
bvhPrimitives.resize(0);
bvhPrimitives.shrink_to_fit();
LOG_VERBOSE("BVH created with %d nodes for %d primitives (%.2f MB)",
totalNodes.load(), (int)primitives.size(),
float(totalNodes.load() * sizeof(LinearBVHNode)) / (1024.f * 1024.f));
Expand Down

0 comments on commit eb1d4ca

Please sign in to comment.