Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#3506 closed enhancement (fixed)

Reduce memory usage by not duplicating button images in memory

Reported by: stuartm Owned by: stuartm
Priority: major Milestone: 0.21
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

The attached 'proof of concept' patch significantly reduces memory usage of mythfrontend with some themes by not loading the same watermarks and icons into memory multiple times. Right now if two menu entries share the same watermark or icon, then that image is loaded each time. The patch instead maintains a list of loaded images and pointers allowing a single image in memory to be shared.

Another benefit should be that startup is marginally faster because we no longer go back to the disk each time.

Example memory savings with blootube-wide (mileage my vary)

Normal - Without Patch
----------------------
VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
593m 302m  33m S  0.0 30.1   0:52.66 mythfrontend

With Patch
----------
VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
435m 143m  33m S  0.0 14.3   0:04.54 mythfrontend

Attachments (2)

reuse_button_images.diff (3.9 KB) - added by stuartm 13 years ago.
Updated patch - no functional changes
reuse_button_images.2.diff (5.1 KB) - added by stuartm 13 years ago.
Added the same prevention of duplicates for title icons

Download all attachments as: .zip

Change History (8)

comment:1 Changed 13 years ago by stuartm

Owner: changed from Isaac Richards to stuartm

comment:2 Changed 13 years ago by clever@…

after old mythtv has been running for a while
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
mythtv   15397  1.5  6.0 185880 31344 pts/3    SLl  May25   7:28 usr/local/bin/mythfrontend

freshly restarted old mythfrontend
mythtv    2399 19.7  9.4 118696 48536 pts/3    RLl  00:28   0:06 mythfrontend

and patched with the above path and freshly restarted
mythtv   15366  8.9  8.4 114532 43452 pts/3    SLl  02:07   0:05 mythfrontend

resident mem usage went down by about 5mb after patching and vm size went down by about 4mb patch does appear to be saving some memory:)

Changed 13 years ago by stuartm

Attachment: reuse_button_images.diff added

Updated patch - no functional changes

Changed 13 years ago by stuartm

Attachment: reuse_button_images.2.diff added

Added the same prevention of duplicates for title icons

comment:3 Changed 13 years ago by stuartm

Second version of patch, this time adding title icons to the images which we avoid loading more than once.

Blootube-wide @ 1280x800

Normal - Without Patch
----------------------
VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
593m 302m  33m S  0.0 30.1   0:52.66 mythfrontend

With second patch
-----------------
VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
425m 133m  31m S  0.0 13.3   0:04.69 mythfrontend

comment:4 Changed 13 years ago by stuartm

Resolution: fixed
Status: newclosed

(In [13513]) Closes #3506

Reduces mythfrontend memory consumption with certain themes by not loading the same image into memory more than once.

Actual savings vary according to theme and resolution - From 0% with Illius to 75% with MythCenter?.

comment:5 Changed 13 years ago by stuartm

(In [13515]) Refs #3506. Clear the list of loaded images on Reset().

comment:6 Changed 13 years ago by stuartm

(In [13554]) Backport [13513] and [13515] to -fixes.

Refs #3506. Reduces mythfrontend memory consumption with certain themes by not loading the same image into memory more than once.

Actual savings vary according to theme and resolution - From almost nothing with Illius upto 75% with MythCenter?.

Note: See TracTickets for help on using tickets.