Add simple checks for large memory leaks

* Smaller memory leaks are harder to differentiate from noise, so we go for a
  large enough leak to be noticable over time (50,000 frames).
This commit is contained in:
baldurk
2021-01-19 15:22:12 +00:00
parent ac3b923075
commit 086b038d0b
17 changed files with 538 additions and 0 deletions
+23
View File
@@ -23,8 +23,31 @@
******************************************************************************/
#include <stdlib.h>
#include <unistd.h>
#include "test_common.h"
uint64_t GetMemoryUsage()
{
FILE *f = fopen("/proc/self/statm", "r");
if(f == NULL)
{
RDCWARN("Couldn't open /proc/self/statm");
return 0;
}
char line[512] = {};
fgets(line, 511, f);
uint32_t vmPages = 0;
int num = sscanf(line, "%u", &vmPages);
if(num == 1 && vmPages > 0)
return vmPages * (uint64_t)sysconf(_SC_PAGESIZE);
return 0;
}
std::string GetCWD()
{
char cwd[MAX_PATH + 1] = {0};