Bug 301349 - parser memleak
Summary: parser memleak
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Services/Magnatune (show other bugs)
Version: 2.5.90 (2.6 beta)
Platform: unspecified Linux
: NOR normal
Target Milestone: 2.6
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks: 284087
  Show dependency treegraph
 
Reported: 2012-06-07 12:15 UTC by Harald Sitter
Modified: 2012-08-18 12:08 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.7
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Sitter 2012-06-07 12:15:29 UTC
==16848== 13,949,308 (2,404,864 direct, 11,544,444 indirect) bytes in 9,394 blocks are definitely lost in loss record 4,151 of 4,151
==16848==    at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16848==    by 0x28AC4152: MagnatuneXmlParser::parseTrack(QDomElement const&) (MagnatuneXmlParser.cpp:324)

The new in question:
> MagnatuneTrack * pCurrentTrack = new MagnatuneTrack( QString() );
subsequently added to a list
> m_currentAlbumTracksList.append( pCurrentTrack );
but never deleted it seems.

A strategically placed qDeleteAll in the dtor should take care of that.

Reproducible: Always

Steps to Reproduce:
1. wipe magnatune settings from amarokrc (update timestamp will prevent a rescan)
2. trigger a scan - e.g. disable and enable the store plugin
3. disable plugin once memory started growing
Actual Results:  
memory of MangatuneTracks not recovered

Expected Results:  
memory recovered

general note of interest: for validation purposes you might want to add debug statements to the ctor && dtor of the track class as memory usage alone will not paint an accurate picture. this is in particular because at least my Qt version has a leak in domdocument itself....
Comment 1 Edward Hades 2012-08-18 12:08:18 UTC
Git commit 5cefb6e013b629f139aba13802b0ac6a33d41e03 by Edward Hades.
Committed on 18/08/2012 at 14:07.
Pushed by hades into branch 'master'.

magnatune: remove memleak in xml parser
FIXED-IN: 2.7

M  +7    -12   src/services/magnatune/MagnatuneXmlParser.cpp
M  +4    -3    src/services/magnatune/MagnatuneXmlParser.h

http://commits.kde.org/amarok/5cefb6e013b629f139aba13802b0ac6a33d41e03