Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in persistence.cc while loading game #3382

Open
bunnybot opened this issue Sep 9, 2019 · 1 comment
Open

Memory leak in persistence.cc while loading game #3382

bunnybot opened this issue Sep 9, 2019 · 1 comment
Labels
memory & performance Fix bottlenecks, memory leaks, ASan, ...

Comments

@bunnybot
Copy link

bunnybot commented Sep 9, 2019

LSan reports a memory leak when loading a savegame.

To reproduce:

  1. Start Widelands
  2. Load a singleplayer savegame. Any win condition should trigger this except for endless game.
  3. Leave game
  4. Close Widelands

#26 0x559cf5134a4e in unpersist_object(lua_State*, FileRead&, Widelands::MapObjectLoader&, unsigned int) ../src/scripting/persistence.cc:281
#27 0x559cf5034d9c in LuaGameInterface::read_global_env(FileRead&, Widelands::MapObjectLoader&, unsigned int) ../src/scripting/logic.cc:166
#28 0x559cf4df5596 in Widelands::MapScriptingPacket::read(FileSystem&, Widelands::EditorGameBase&, bool, Widelands::MapObjectLoader&) ../src/map_io/map_scripting_packet.cc:72
#29 0x559cf486ecbd in Widelands::WidelandsMapLoader::load_map_complete(Widelands::EditorGameBase&, Widelands::MapLoader::LoadType) ../src/map_io/widelands_map_loader.cc:326


Imported from Launchpad using lp2gh.

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by gunchleoc)
I managed to fix 1 of 2 memory leaks in the attached branch: The remaining leak:

Direct leak of 128 byte(s) in 4 object(s) allocated from:
#0 0x7f7c3fdd2f40 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef40)
#1 0x5617582dba7b in l_alloc ../src/third_party/eris/lauxlib.c:1015
#2 0x5617582e8cb2 in luaM_realloc_ ../src/third_party/eris/lmem.c:86
#3 0x5617582e3171 in luaF_initupvals ../src/third_party/eris/lfunc.c:48
#4 0x5617582d29a1 in u_closure ../src/third_party/eris/eris.c:1603
#5 0x5617582d46a2 in unpersist ../src/third_party/eris/eris.c:2307
#6 0x5617582d3518 in u_thread ../src/third_party/eris/eris.c:1892
#7 0x5617582d46be in unpersist ../src/third_party/eris/eris.c:2313
#8 0x5617582d0d5d in u_literaltable ../src/third_party/eris/eris.c:1013
#9 0x5617582d13ae in u_special ../src/third_party/eris/eris.c:1154
#10 0x5617582d13f7 in u_table ../src/third_party/eris/eris.c:1167
#11 0x5617582d4694 in unpersist ../src/third_party/eris/eris.c:2304
#12 0x5617582d0d5d in u_literaltable ../src/third_party/eris/eris.c:1013
#13 0x5617582d13ae in u_special ../src/third_party/eris/eris.c:1154
#14 0x5617582d13f7 in u_table ../src/third_party/eris/eris.c:1167
#15 0x5617582d4694 in unpersist ../src/third_party/eris/eris.c:2304
#16 0x5617582d22ca in u_upval ../src/third_party/eris/eris.c:1426
#17 0x5617582d46da in unpersist ../src/third_party/eris/eris.c:2319
#18 0x5617582d2a72 in u_closure ../src/third_party/eris/eris.c:1617
#19 0x5617582d46a2 in unpersist ../src/third_party/eris/eris.c:2307
#20 0x5617582d0d5d in u_literaltable ../src/third_party/eris/eris.c:1013
#21 0x5617582d13ae in u_special ../src/third_party/eris/eris.c:1154
#22 0x5617582d13f7 in u_table ../src/third_party/eris/eris.c:1167
#23 0x5617582d4694 in unpersist ../src/third_party/eris/eris.c:2304
#24 0x5617582d50e1 in unchecked_unpersist ../src/third_party/eris/eris.c:2558
#25 0x5617582d59e3 in eris_undump ../src/third_party/eris/eris.c:2742
#26 0x5617581f92d2 in unpersist_object(lua_State*, FileRead&, Widelands::MapObjectLoader&, unsigned int) ../src/scripting/persistence.cc:281
#27 0x5617580f9524 in LuaGameInterface::read_global_env(FileRead&, Widelands::MapObjectLoader&, unsigned int) ../src/scripting/logic.cc:166
#28 0x561757eb9cfc in Widelands::MapScriptingPacket::read(FileSystem&, Widelands::EditorGameBase&, bool, Widelands::MapObjectLoader&) ../src/map_io/map_scripting_packet.cc:72
#29 0x561757933267 in Widelands::WidelandsMapLoader::load_map_complete(Widelands::EditorGameBase&, Widelands::MapLoader::LoadType) ../src/map_io/widelands_map_loader.cc:326

@bunnybot bunnybot added this to the build21-rc1 milestone Sep 9, 2019
@gunchleoc gunchleoc added memory & performance Fix bottlenecks, memory leaks, ASan, ... launchpad_done and removed asan labels Sep 11, 2019
@Noordfrees Noordfrees modified the milestones: build21-rc1, build22-rc1 Apr 14, 2020
@Noordfrees Noordfrees modified the milestones: v1.0, v1.1 Jan 4, 2021
@Noordfrees Noordfrees removed this from the v1.1 milestone Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
memory & performance Fix bottlenecks, memory leaks, ASan, ...
Projects
None yet
Development

No branches or pull requests

3 participants