[Freeciv-Dev] [bug #15519] ai_settler_init() memory leak
Update of bug #15519 (project freeciv): Assigned to:None = syntron ___ Reply to this item at: http://gna.org/bugs/?15519 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #15519] ai_settler_init() memory leak
Follow-up Comment #2, bug #15519 (project freeciv): Problem is that it's never freed after last allocation. To be completely clean, server should free it when quitting. ___ Reply to this item at: http://gna.org/bugs/?15519 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #15519] ai_settler_init() memory leak
Follow-up Comment #3, bug #15519 (project freeciv): I'm working on a patch changing the the usage of the struct cityresult. This will also change cachemap to use fc_malloc() / free(). It is connected to the cityresult patches. I try to change all city map related places to use the city map index instead of the x,y coordinates. ___ Reply to this item at: http://gna.org/bugs/?15519 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #15519] ai_settler_init() memory leak
URL: http://gna.org/bugs/?15519 Summary: ai_settler_init() memory leak Project: Freeciv Submitted by: cazfi Submitted on: Monday 03/01/2010 at 16:34 Category: None Severity: 3 - Normal Priority: 1 - Later Status: None Assigned to: None Originator Email: Open/Closed: Open Release: S2_2 r16933 Discussion Lock: Any Operating System: None Planned Release: ___ Details: I run longish autogame in Valgrind. I'm not going to submit separate ticket for all of the memory loos records. Several cases of the unfreed memory is allocated in end_phase() - xxx_init(). It's likely that all these seemingly separate leaks are caused by one bug causing proper xxx_deinit() for these xxx_init() functions not to run. Example report, one with most memory consumed: ==27020== 32,448 bytes in 1 blocks are still reachable in loss record 1,185 of 1,186 ==27020==at 0x4C222A8: realloc (vg_replace_malloc.c:476) ==27020==by 0x506554: fc_real_realloc (mem.c:104) ==27020==by 0x497B03: ai_settler_init (aisettler.c:455) ==27020==by 0x40962E: end_phase (srv_main.c:859) ==27020==by 0x40B09D: srv_running (srv_main.c:2100) ==27020==by 0x40C29E: srv_main (srv_main.c:2458) ==27020==by 0x404334: main (civserver.c:359) ==27020== ___ Reply to this item at: http://gna.org/bugs/?15519 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #15519] ai_settler_init() memory leak
Follow-up Comment #1, bug #15519 (project freeciv): The function this points to has the following code: void ai_settler_init(struct player *pplayer) { cachemap = fc_realloc(cachemap, MAP_INDEX_SIZE * sizeof(*cachemap)); memset(cachemap, -1, MAP_INDEX_SIZE * sizeof(*cachemap)); } The cachemap is only used within this file. Could it be that valgrind reports this due to the fact that this memory is never freed within the code but reused? Related (solved) bug wrt other reallocated pointers: bugs #15305 ___ Reply to this item at: http://gna.org/bugs/?15519 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev