From 45ec4161781755dedc926341f98da2b8fa33695a Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Tue, 22 Apr 2014 08:46:36 +0200 Subject: 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. --- lib/Support/MemoryUsage.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/Support/MemoryUsage.cpp (limited to 'lib/Support') 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 + +using namespace klee; + +size_t util::GetTotalMemoryUsage() { + // This is linux platform specific + struct mallinfo mi = ::mallinfo(); + return mi.uordblks + mi.hblkhd; +} -- cgit 1.4.1