office-gobmx/i18npool/source/breakiterator
Michael Weghorn d437076142 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 26a46c1143
    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>
2022-04-29 21:10:25 +02:00
..
data
breakiterator_cjk.cxx
breakiterator_th.cxx
breakiterator_unicode.cxx
breakiteratorImpl.cxx
gendict.cxx
xdictionary.cxx