#1937 closed defect (fixed)
[PATCH] Memory leak in CSoundData::SoundDataFromFile
Reported by: | historic_bruno | Owned by: | stwf |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 14 |
Component: | Core engine | Keywords: | memleak patch |
Cc: | Patch: |
Description
CSoundData::sSoundData
is dynamically allocated but never freed.
{198614} normal block at 0x0A0D6678, 52 bytes long. Data: <xf xf xf > 78 66 0D 0A 78 66 0D 0A 78 66 0D 0A CD CD CD CD {198613} normal block at 0x0A0E73A8, 8 bytes long. Data: < > A0 14 0C 0A 00 00 00 00 {198612} normal block at 0x0A0C14A0, 20 bytes long. Data: < s xf > A8 73 0E 0A CD CD CD CD 78 66 0D 0A 00 00 00 00
Call stack of allocation 198612:
msvcr100d.dll!_heap_alloc_dbg_impl(unsigned int nSize, int nBlockUse, const char * szFileName, int nLine, int * errno_tmp) Line 393 C++ msvcr100d.dll!_nh_malloc_dbg_impl(unsigned int nSize, int nhFlag, int nBlockUse, const char * szFileName, int nLine, int * errno_tmp) Line 239 + 0x19 bytes C++ msvcr100d.dll!_nh_malloc_dbg(unsigned int nSize, int nhFlag, int nBlockUse, const char * szFileName, int nLine) Line 302 + 0x1d bytes C++ msvcr100d.dll!malloc(unsigned int nSize) Line 56 + 0x15 bytes C++ msvcr100d.dll!operator new(unsigned int size) Line 59 + 0x9 bytes C++ pyrogenesis_dbg.exe!CSoundData::SoundDataFromFile(const Path & itemPath) Line 71 + 0x7 bytes C++ pyrogenesis_dbg.exe!CSoundManager::LoadItem(const Path & itemPath) Line 535 + 0x9 bytes C++ pyrogenesis_dbg.exe!JMusicSound::Loop(JSContext * __formal, JSContext * __formal, JSContext * __formal) Line 58 + 0x12 bytes C++ pyrogenesis_dbg.exe!CNativeFunction<JMusicSound,0,bool,{JMusicSound::Loop,0,0,0}>::JSFunction(JSContext * cx, unsigned int argc, unsigned __int64 * vp) Line 188 + 0x4e bytes C++ mozjs185-ps-debug-1.0.dll!55c8e069()
Attachments (1)
Change History (6)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Keywords: | patch review added |
---|---|
Milestone: | Backlog → Alpha 14 |
Summary: | Memory leak in CSoundData::SoundDataFromFile → [PATCH] Memory leak in CSoundData::SoundDataFromFile |
comment:3 by , 11 years ago
WHen the SoundManager is disabled during the game it's actually deleted and set to null. I like my stuff clean, so this map should be deleted in that case. But I suppose there are advantages to doing it this way. Opinions? Memory wise it seems like a static is similar to a leak since everything gets released when the app closes.
Also I can't shake my old timey style when we had to keep track of the stack size. historic_bruno it's your call !
comment:4 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
OK, I incorporated this. Thanks for the help!
comment:5 by , 11 years ago
Keywords: | review removed |
---|
Note:
See TracTickets
for help on using tickets.
Thats kind of right. The memory is allocated (only once). And always reused. The pointer is still kept, because its static. I dont even know, why its created on the heap?