mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-27 11:40:07 +00:00
Merge remote-tracking branch 'origin/Applications/18.04'
This commit is contained in:
commit
66b5f9c83c
|
@ -10,6 +10,10 @@ else (OKULAR_FORCE_DRM)
|
|||
set(_OKULAR_FORCE_DRM 0)
|
||||
endif (OKULAR_FORCE_DRM)
|
||||
|
||||
# Check whether malloc_trim(3) is supported.
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(malloc_trim "malloc.h" HAVE_MALLOC_TRIM)
|
||||
|
||||
# at the end, output the configuration
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/config-okular.h.cmake
|
||||
|
|
|
@ -4,3 +4,6 @@
|
|||
/* Defines if the purpose framework is available */
|
||||
#define PURPOSE_FOUND ${PURPOSE_FOUND}
|
||||
|
||||
/* Defines if the purpose framework is available */
|
||||
#cmakedefine01 HAVE_MALLOC_TRIM
|
||||
|
||||
|
|
|
@ -98,6 +98,10 @@
|
|||
|
||||
#include <config-okular.h>
|
||||
|
||||
#if HAVE_MALLOC_TRIM
|
||||
#include "malloc.h"
|
||||
#endif
|
||||
|
||||
using namespace Okular;
|
||||
|
||||
struct AllocatedPixmap
|
||||
|
@ -2743,6 +2747,13 @@ void Document::closeDocument()
|
|||
|
||||
d->m_undoStack->clear();
|
||||
d->m_docdataMigrationNeeded = false;
|
||||
|
||||
#if HAVE_MALLOC_TRIM
|
||||
// trim unused memory, glibc should do this but it seems it does not
|
||||
// this can greatly decrease the [perceived] memory consumption of okular
|
||||
// see: https://sourceware.org/bugzilla/show_bug.cgi?id=14827
|
||||
malloc_trim(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Document::addObserver( DocumentObserver * pObserver )
|
||||
|
|
Loading…
Reference in a new issue