1
0
forked from 0ad/0ad
0ad/source/simulation2/helpers
wraitii 2cc071f306 Fix memory leak introduced by 3a839517ce in SparseGrid
Following 3a839517ce, SparseGrid::Reset() replaces the value of m_Data
(a C-style dynamically sized array) with a new value-initialised array,
by using the new operator. Previous code simply did a memset.
This means that when m_Data was not null, it leaked memory as the
previous array was not deleted.

SparseGrid::Reset is called when destroying the sparse grid, and a
SparseGrid is used by the long pathfinder when computing JPS paths. As
that is called rather often, it resulted in a relatively serious memory
leak that could make very long games use several GB of memory.

This fixes the leak by using placement new, which re-uses the memory,
effectively doing the same as the previously existing memset.

Profiling by historic_bruno and elexis showed that performance from
value-initialising with placement new was at worst similar to memset,
and testing shows this was compiled in a memset call in several cases
anyways.

Reviewed By: elexis
Fixes #5522

Differential Revision: https://code.wildfiregames.com/D2121
This was SVN commit r22545.
2019-07-24 17:11:22 +00:00
..
CinemaPath.cpp Move CinemaPath class to the simulation helper directory, because it contains predominantly simulation data that is already serialized. 2017-04-14 23:20:49 +00:00
CinemaPath.h Move CinemaPath class to the simulation helper directory, because it contains predominantly simulation data that is already serialized. 2017-04-14 23:20:49 +00:00
Geometry.cpp Move "IsInRange" family of functions to the Obstruction Manager and make the commutative. 2019-06-06 19:37:23 +00:00
Geometry.h Move "IsInRange" family of functions to the Obstruction Manager and make the commutative. 2019-06-06 19:37:23 +00:00
Grid.h Fix memory leak introduced by 3a839517ce in SparseGrid 2019-07-24 17:11:22 +00:00
HierarchicalPathfinder.cpp Hierarchical pathfinder: Speed up edge update 2019-05-13 17:02:16 +00:00
HierarchicalPathfinder.h Hierarchical pathfinder: Speed up edge update 2019-05-13 17:02:16 +00:00
LongPathfinder.cpp Fix a m_JumpPointCache assertion failure in debug mode, refs fa726867f1. 2019-06-04 08:29:47 +00:00
LongPathfinder.h Decouple long and hierarchical pathfinders to an extent. 2019-05-13 16:58:00 +00:00
MapEdgeTiles.h Unify the magic number indicating the number of impassable tiles at the map edge redundant in the Pathfinder, RangeManager and MapGenerator. 2019-07-12 16:38:51 +00:00
Pathfinding.h Adapt unitMotion to edge-edge distance checks. 2019-07-01 19:50:06 +00:00
PathGoal.cpp Consider that the point could be inside the goal area in some PathGoal functions 2018-01-16 02:15:04 +00:00
PathGoal.h Consider that the point could be inside the goal area in some PathGoal functions 2018-01-16 02:15:04 +00:00
Player.h Set svn:eol-style=native, fix some inconsistent line endings 2013-12-06 00:42:50 +00:00
Position.h Rename CELL_SIZE to TERRAIN_TILE_SIZE, to free up the term "cell" for other concepts. 2012-01-12 12:51:10 +00:00
PriorityQueue.h New long-range pathfinder. 2015-06-12 18:58:24 +00:00
Rasterize.cpp Actually remove trailing tabs from source/. 2016-11-23 14:09:58 +00:00
Rasterize.h New long-range pathfinder. 2015-06-12 18:58:24 +00:00
Render.cpp Don't crash when calling the profiler from a 'non-main' thread 2019-05-04 15:03:10 +00:00
Render.h Move selection ring OverlayTexture code from CCmpSelectable::UpdateTexturedLineOverlay to the SOverlayTexturedLine struct in graphics/Overlay.cpp and SimRender in simulation2/helpers/Render.cpp. 2017-12-10 00:19:51 +00:00
Selection.cpp Cleanup the rest of the mess introduced with the NonGaiaEntities functions in 8c7b6dceaa. 2017-03-25 02:42:51 +00:00
Selection.h Cleanup the rest of the mess introduced with the NonGaiaEntities functions in 8c7b6dceaa. 2017-03-25 02:42:51 +00:00
SimulationCommand.h SpiderMonkey 38 upgrade: 10/35 2016-09-02 16:24:46 +00:00
Spatial.h Remove trailing whitespace and whitespace in empty lines of source/ except source/third_party/. 2016-11-23 11:18:37 +00:00
VertexPathfinder.cpp UnitMotion - Send messages to UnitAI when obstructed, to allow stopping early when walking and avoiding pathfinding lag. 2019-07-22 18:07:24 +00:00
VertexPathfinder.h Remove 'Async' from short/long path requests names 2019-05-26 13:47:41 +00:00