MantisBT - NetSurf
View Issue Details
0002579NetSurf[All Projects] Generalpublic2017-12-06 14:382018-08-29 15:04
ReporterFelix S. 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.7 
Target Version3.8Fixed in Version3.8 
Fixed in CI build #4292
Reported in CI build #
URL of problem page
Summary0002579: Memory leak in a cache back-end
DescriptionThere is a memory leak in cache code. Two allocations made in the file system backend (content/fs_backing_store.c) are apparently never disposed of: one in read_entries() and one in build_entrymap().
Steps To ReproduceThis problem should be possible to detect with any memory leak detection tool. (The particular tool used to write this report was memtrail[0], chosen mainly for its low instrumentation overhead.)

[0]: <https://github.com/jrfonseca/memtrail/>
Additional InformationFragment of the output of memtrail report:

leaked: 9,425,771B
  -> 64.22% (6,053,352B): calloc
  | -> 27.81% (2,621,440B): read_entries [./netsurf/content/fs_backing_store.c:1230]
  | | -> 27.81% (2,621,440B): hlcache_initialise [./netsurf/content/hlcache.c:535]
  | | -> 27.81% (2,621,440B): netsurf_init [./netsurf/desktop/netsurf.c:226]
  | | -> 27.81% (2,621,440B): main [./netsurf/frontends/gtk/gui.c:1178]
  | | -> 27.81% (2,621,440B): __libc_start_main [/build/glibc-mcIJEN/glibc-2.25/csu/../csu/libc-start.c:297]
  | | -> 27.81% (2,621,440B): _start
  | |
  | -> 22.25% (2,097,152B): build_entrymap [./netsurf/content/fs_backing_store.c:1148]
  | | -> 22.25% (2,097,152B): hlcache_initialise [./netsurf/content/hlcache.c:535]
  | | -> 22.25% (2,097,152B): netsurf_init [./netsurf/desktop/netsurf.c:226]
  | | -> 22.25% (2,097,152B): main [./netsurf/frontends/gtk/gui.c:1178]
  | | -> 22.25% (2,097,152B): __libc_start_main [/build/glibc-mcIJEN/glibc-2.25/csu/../csu/libc-start.c:297]
  | | -> 22.25% (2,097,152B): _start
  | |
...

Attached patch seems to fix the problem.
TagsNo tags attached.
Attached Filespatch netsurf-cache-memleak.patch (794) 2017-12-06 14:38
https://bugs.netsurf-browser.org/mantis/file_download.php?file_id=526&type=bug

Notes
(0001707)
John-Mark Bell   
2018-01-20 16:20   
Thanks for the report. Patch applied in master.
(0001840)
Vincent Sanders   
2018-08-29 15:04   
Thank you for your report, this has been resolved in the 3.8 release

Issue History
2017-12-06 14:38Felix S.New Issue
2017-12-06 14:38Felix S.File Added: netsurf-cache-memleak.patch
2018-01-20 16:20John-Mark BellStatusnew => resolved
2018-01-20 16:20John-Mark BellResolutionopen => fixed
2018-01-20 16:20John-Mark BellFixed in Version => 3.8
2018-01-20 16:20John-Mark BellTarget Version => 3.8
2018-01-20 16:20John-Mark BellSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=1995#r1995
2018-01-20 16:20John-Mark BellAdditional Information Updatedbug_revision_view_page.php?rev_id=1997#r1997
2018-01-20 16:20John-Mark BellFixed in CI build # => 4292
2018-01-20 16:20John-Mark BellNote Added: 0001707
2018-08-29 15:04Vincent SandersStatusresolved => closed
2018-08-29 15:04Vincent SandersNote Added: 0001840