mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-16 13:48:04 +00:00
Call malloc_trim(0) on Linux
This commit is contained in:
parent
2328141d98
commit
3f44307268
@ -2623,6 +2623,10 @@ void QueryDbMain(const std::string& bin_name, Config* config, MultiQueueWaiter*
|
||||
config, &db, waiter, &queue,
|
||||
&project, &file_consumer_shared, &import_manager, ×tamp_manager, &working_files,
|
||||
&clang_complete, &include_complete, global_code_complete_cache.get(), non_global_code_complete_cache.get(), signature_cache.get());
|
||||
|
||||
// Cleanup and free any unused memory.
|
||||
FreeUnusedMemory();
|
||||
|
||||
if (!did_work) {
|
||||
waiter->Wait({
|
||||
IpcManager::instance()->threaded_queue_for_server_.get(),
|
||||
|
@ -50,4 +50,7 @@ void CopyFileTo(const std::string& destination, const std::string& source);
|
||||
bool IsSymLink(const std::string& path);
|
||||
|
||||
// Returns any clang arguments that are specific to the current platform.
|
||||
std::vector<std::string> GetPlatformClangArguments();
|
||||
std::vector<std::string> GetPlatformClangArguments();
|
||||
|
||||
// Free any unused memory and return it to the system.
|
||||
void FreeUnusedMemory();
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <loguru.hpp>
|
||||
|
||||
#include <malloc.h>
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <pthread.h>
|
||||
@ -247,4 +248,8 @@ std::vector<std::string> GetPlatformClangArguments() {
|
||||
}
|
||||
#undef CHECKED
|
||||
|
||||
void FreeUnusedMemory() {
|
||||
malloc_trim(0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -226,4 +226,7 @@ std::vector<std::string> GetPlatformClangArguments() {
|
||||
"-fdelayed-template-parsing"
|
||||
};
|
||||
}
|
||||
|
||||
void FreeUnusedMemory() {}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user