Issue #225: Fix for memleak when loading terrain. #150

merged 4 commits into from Apr 4, 2012


None yet

2 participants


here is fix for memleak when loading terrain data.

best regards,


Need to think about it more. Your fix is at least incomplete, since copying and assignments will cause problems. But the whole land record code looks incorrect in the first place.


You're right, I will prepare another patch today.

@lgromanowski lgromanowski Issue #225: Correction to commit ae98904.
Changed pointer to LandData struct to simple member variable.

is patch 0e5c90d good, or should be changed?


The problem with this approach is that it increases the memory consumption a lot. If my calculations are right easily in the order of magnitude of 100MB. And most of this memory will probably never be used during a playing session.
Actually, the land data should not be part of this record at all, because you are not supposed to modify the ESM store after the loading is complete (it is only possible because some other code breaks constness rules). But that is something we really need think through better and this is not the time for it. As a quick fix, I suggest to return to the pointer approach and disable copy constructor and assignment operator (declare them privately and don't implement them). This will break the code once we start optimising the ESM store containers, but at least it won't do so silently and produces an error message during the build process isntead.

lgromanowski added some commits Apr 4, 2012
@lgromanowski lgromanowski Revert "Issue #225: Correction to commit ae98904."
This reverts commit 0e5c90d.
@lgromanowski lgromanowski Issue #225: Land struct is not copyable.
Disabled copy constructor and assignment operator in Land structure.

Copy constructor and assignment operator are now disabled for Land structure.

@zinnschlag zinnschlag merged commit ea8e5cb into zinnschlag:master Apr 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment