Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions test/common/memory_usage.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ namespace utils {
peakUsage
};

#if __unix__
#if __unix__ && ! defined(__gnu_hurd__)

inline unsigned LinuxKernelVersion()
{
unsigned digit1, digit2, digit3;
Expand Down Expand Up @@ -125,9 +126,11 @@ namespace utils {
break;
}
}
// VmPeak is available in kernels staring 2.6.15
#if !defined(__gnu_hurd__)
// VmPeak is available in Linux kernels staring 2.6.15
if (stat != peakUsage || LinuxKernelVersion() >= 2006015)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic in the legacy is "size must be non-zero, except for VmPeak and really old Linux". And what is your assumption? Why you think is it reasonable to drop this check in every case?

ASSERT(size, "Invalid /proc/self/status format, pattern not found.");
#endif
fclose(fst);
return size * 1024;
#elif __APPLE__ && !__ARM_ARCH
Expand Down
Loading