[mythtv] Re: Myth Theme Memory Usage

Chris Tracy mythtv at adiemus.org
Wed Dec 8 21:46:09 UTC 2004


Well,

	I've done a bit more digging and found that memory usage is 
directly related to the size of the screen.  For example, with Titivillus, 
if I set my resolution to 800x600 (or just set myth to show an 800x600 
window) then the native res of the theme pics is used and mythfrontend 
uses a relatively small amount of memory.  At 1280x768, the usage is 
almost double, and at 1600x1200 it's almost triple.

	I'm using qt-3.1.2-14.2 and myth from CVS today (12/8/04) on a FC1
box.  (Actually, the same config on two boxes, both with the same 
behavior)

	Here are the exact numbers with each theme:

            |   Blue   |   G.A.N.T.   |  Titivillus
------------+----------+--------------+-------------
800x600     |   37M    |     59M      |     73M
1024x768    |   39M    |     80M      |    105M
1280x768    |   37M    |     90M      |    119M
1280x1024   |   45M    |    118M      |    158M
1600x1200   |   54M    |    162M      |    221M
------------+----------+--------------+-------------
Total       |   17M    |    103M      |    148M
Increase    | (1.46x)  |   (2.75x)    |  (3.03x)

	As near as I can tell, the major culprits for the huge increase in
G.A.N.T. and Titivillus is their use of watermark images.  (Blue doesn't
have any.)

	Having fumbled my way through debugging the issue, I added some
code in libs/libmyth/themedmenu.cpp to ThemedMenuPrivate::parseSettings().  
In the main while loop (around line 1255) I added a system() call to print
out the memory usage of mythfrontend during each iteration through the
loop.  What I found is that calls to ThemedMenuPrivate::parseButton()  
seemed to be the culprit.  Looking deeper, calls from parseButton() to 
MythContext::LoadScaleImage() were to blame, but only when loading 
watermark images and then only in certain cases.

	Tracing the path of a Titivillus load through 
ThemedMenuPrivate::parseSettings() the process is using 46948kb of RAM 
though the first 27 iterations through the while() loop, when we reach the 
first watermark (watermark/dvd.png).  This gets loaded but there is no 
change in memory usage.  We proceed through several more iterations, 
including several watermark images until we reach iteration 35, which 
seeks to load 'text-blank.png' and 'watermark/dvd_rip.png'.  (Note, this 
is the 6th time 'text-blank.png' has been run through LoadScaleImage() and 
the 2nd time for 'watermark/dvd_rip.png')  After this iteration, memory 
usage increases to 48552kb (the screen res is 1600x1200).

	From this point on, memory only and always increases on while() 
loop iterations that call LoadScaleImage() on watermark images.  
Interestingly, for each iteration, regardless of the image loaded, the 
memory increase is always 1996kb (@1600x1200).

	Unfortunately, I don't know enough about qt to debug this to a 
solution.  But hopefully someone who does can use this info.

	As a side note, just to test, I commented out all the 
<watermarkimage> entries in 'Titivillus/theme.xml' and reloaded the theme.  
With a res of 1600x1200, memory usage dropped from 221M to 77M.

	Hope this is helpful,

	Chris



More information about the mythtv-dev mailing list