[ Return to Bugs & Features | Post Text | Post File | Prev | Next ]
|Status:||5 - New|
|Priority:||2 - Low, e.g. a documentation error or undocumented side-effect|
|Scope:||3 - Applies to all machines and operating systems|
|Summary:||Fl_Help_View may leak memory when images are in the HTML|
Trouble Report Files:
[ Post File ]
Trouble Report Comments:
[ Post Text ]
01:50 Mar 17, 2017
|When a Fl_Help_View contains images these are loaded via Fl_Shared_Image::get(). When the view is deleted these images are not always (*) unloaded from memory. This can be observed with the 'help_dialog' demo: Listing the shared memory array after the 'delete help' shows there are still images in memory. |
The cause is that images sometimes get loaded twice during the initial load, so their refcount is 2, and when releasing them at deletion of the help view they are not deleted.
(*) I found two cases:
- images in a table seem to get loaded twice always (as in help_demo).
- when an image is encaountered during format() that is broader than the "current" width, the format loop is re-done and images get loaded again.
01:55 Mar 17, 2017
|> listing the shared memory array.. |
This should read: listing the shared images array..
svn diff help_dialog.cxx
--- help_dialog.cxx (Revision 12188)
+++ help_dialog.cxx (Arbeitskopie)
@@ -65,6 +65,14 @@
+ int n = Fl_Shared_Image::num_images();
+ for ( int i = 0; i < n; i++ )
+ Fl_Shared_Image *img = Fl_Shared_Image::images()[i];
+ printf( "%d: %s %d x %d ref=%d\n", i + 1, img->name(), img->w(),
img->h(), img->refcount() );
11:58 Mar 20, 2017
|Posting a possible simple solution: Memorize how far parsing in format() already came before re-parsing and load images only 'initial' when beyond that point (again). ||
[ Return to Bugs & Features | Post Text | Post File ]