mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
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:
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user