diff options
author | Martin Nowack <martin@se.inf.tu-dresden.de> | 2014-04-22 08:46:36 +0200 |
---|---|---|
committer | Martin Nowack <martin@se.inf.tu-dresden.de> | 2014-04-24 13:51:41 +0200 |
commit | 45ec4161781755dedc926341f98da2b8fa33695a (patch) | |
tree | 499b7eb4177038342f330333a16e9ff4657be929 /lib/Support/MemoryUsage.cpp | |
parent | 292e8cc794f01df94ca02279f5833d7a460a62f9 (diff) | |
download | klee-45ec4161781755dedc926341f98da2b8fa33695a.tar.gz |
Fix handling of memory usage in KLEE.
Memory usage API in LLVM since 3.3 is not working the way it is intended by KLEE. This ports the pre 3.3. version to KLEE. Fixes the malloc test case.
Diffstat (limited to 'lib/Support/MemoryUsage.cpp')
-rw-r--r-- | lib/Support/MemoryUsage.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Support/MemoryUsage.cpp b/lib/Support/MemoryUsage.cpp new file mode 100644 index 00000000..1bdff819 --- /dev/null +++ b/lib/Support/MemoryUsage.cpp @@ -0,0 +1,19 @@ +//===-- MemoryUsage.cpp ---------------------------------------------------===// +// +// The KLEE Symbolic Virtual Machine +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "klee/Internal/System/MemoryUsage.h" +#include <malloc.h> + +using namespace klee; + +size_t util::GetTotalMemoryUsage() { + // This is linux platform specific + struct mallinfo mi = ::mallinfo(); + return mi.uordblks + mi.hblkhd; +} |