Skip to content

Commit

Permalink
Fixes to "BAR105 reduce QTPFS memory usage" (#1935)
Browse files Browse the repository at this point in the history
Second attempt. First attempt was accepted, but we since found a bug. The bug has been fixed and now this change is put forward for remerging.

Fixes #1934
  • Loading branch information
lostsquirrel1 authored Feb 8, 2025
1 parent 5ae24c0 commit 953b5d1
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions rts/Sim/Path/QTPFS/PathThreads.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ namespace QTPFS {
struct UpdateThreadData {
std::vector<std::uint8_t> maxBlockBits;
std::vector<INode*> relinkNodeGrid;
SRectangle areaUpdated;
SRectangle areaRelinkedInner;
SRectangle areaRelinked;
SRectangle areaMaxBlockBits;
Expand All @@ -171,7 +170,6 @@ namespace QTPFS {
moveDef = &md;
auto mapRect = MapToRectangle();

areaUpdated = area;
areaRelinkedInner = SRectangle ( topNode.xmin()
, topNode.zmin()
, topNode.xmax()
Expand All @@ -180,10 +178,10 @@ namespace QTPFS {
, topNode.zmin() - 1
, topNode.xmax() + 1
, topNode.zmax() + 1);
areaMaxBlockBits = SRectangle ( area.x1 - md.xsizeh
, area.z1 - md.zsizeh
, area.x2 + md.xsizeh
, area.z2 + md.zsizeh);
areaMaxBlockBits = SRectangle ( topNode.xmin() - md.xsizeh
, topNode.zmin() - md.zsizeh
, topNode.xmax() + md.xsizeh
, topNode.zmax() + md.zsizeh);
areaRelinked.ClampIn(mapRect);
areaMaxBlockBits.ClampIn(mapRect);

Expand Down Expand Up @@ -212,10 +210,9 @@ namespace QTPFS {
}

void Reset() {
areaUpdated = SRectangle(0, 0, 0, 0);
areaRelinked = areaUpdated;
areaMaxBlockBits = areaUpdated;
areaRelinkedInner = areaUpdated;
areaRelinked = SRectangle(0, 0, 0, 0);
areaMaxBlockBits = areaRelinked;
areaRelinkedInner = areaRelinked;
relinkNodeGrid.resize(0);
relinkNodeGrid.shrink_to_fit();
maxBlockBits.resize(0);
Expand Down

0 comments on commit 953b5d1

Please sign in to comment.