mirror of
https://github.com/hyprwm/hyprpaper.git
synced 2025-05-12 13:20:41 +01:00
core: add mallopt to modify trim threshold
This commit is contained in:
parent
f827dc3197
commit
7e18ebc843
1 changed files with 15 additions and 1 deletions
|
@ -3,8 +3,22 @@
|
|||
#include <fstream>
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <malloc.h>
|
||||
#include <unistd.h>
|
||||
|
||||
CHyprpaper::CHyprpaper() = default;
|
||||
static void setMallocThreshold() {
|
||||
#ifdef M_TRIM_THRESHOLD
|
||||
// The default is 128 pages,
|
||||
// which is very large and can lead to a lot of memory used for no reason
|
||||
// because trimming hasn't happened
|
||||
static const int PAGESIZE = sysconf(_SC_PAGESIZE);
|
||||
mallopt(M_TRIM_THRESHOLD, 6 * PAGESIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
CHyprpaper::CHyprpaper() {
|
||||
setMallocThreshold();
|
||||
}
|
||||
|
||||
static void handleGlobal(CCWlRegistry* registry, uint32_t name, const char* interface, uint32_t version) {
|
||||
if (strcmp(interface, wl_compositor_interface.name) == 0) {
|
||||
|
|
Loading…
Reference in a new issue