mirror of
https://github.com/MaskRay/ccls.git
synced 2025-04-14 21:02:14 +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,
|
config, &db, waiter, &queue,
|
||||||
&project, &file_consumer_shared, &import_manager, ×tamp_manager, &working_files,
|
&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());
|
&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) {
|
if (!did_work) {
|
||||||
waiter->Wait({
|
waiter->Wait({
|
||||||
IpcManager::instance()->threaded_queue_for_server_.get(),
|
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);
|
bool IsSymLink(const std::string& path);
|
||||||
|
|
||||||
// Returns any clang arguments that are specific to the current platform.
|
// 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 <loguru.hpp>
|
||||||
|
|
||||||
|
#include <malloc.h>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@ -247,4 +248,8 @@ std::vector<std::string> GetPlatformClangArguments() {
|
|||||||
}
|
}
|
||||||
#undef CHECKED
|
#undef CHECKED
|
||||||
|
|
||||||
|
void FreeUnusedMemory() {
|
||||||
|
malloc_trim(0);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -226,4 +226,7 @@ std::vector<std::string> GetPlatformClangArguments() {
|
|||||||
"-fdelayed-template-parsing"
|
"-fdelayed-template-parsing"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FreeUnusedMemory() {}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user