summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2022-04-29 15:23:41 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2022-04-29 21:10:25 +0200
commitd4370761421508522a29c5206aea6e538d71b342 (patch)
tree47f3b0c350cc6f86965a6206f44c10e86b32cf8c /sd
parent515bf5d4afa3a8ed413fd6f17f66fa98b6dbf29e (diff)
tdf#148851 Unmap + close file again in xdictionary dtor
The file opened and mapped to memory in the `xdictionary` ctor was never unmapped and closed again, resulting in a memory leak. For Android Viewer, this resulted in the app running out of memory after a while when scrolling up and down in the Chinese sample doc from tdf#148851. On Android, closing the file is actually the relevant part, because the content of files from `/assets` is automatically loaded into memory when the files are opened (s. the call to `openMemoryAsFile` in `openFilePath` in `sal/osl/unx/file.cxx`) and that memory is only freed when the file is closed again (s. `osl_closeFile`). When using the sample doc, the file in question was "file:///assets/share/dict_zh.data", which has a size of 2.2 MB and is therefore actually loaded into memory anew every time, since only files below 50 KiB are handled by the file cache introduced in commit 26a46c1143e34e361d76d6459535c2056c59de77 Date: Fri Dec 20 14:46:36 2019 +0000 android: file-cache to improve performance. Fix the memory leak by unmapping and closing the file again in the dtor. Change-Id: I3388964877080d1f2b3cf2682a41549e0bfb850c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133581 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'sd')
0 files changed, 0 insertions, 0 deletions