about summary refs log tree commit diff homepage
path: root/lib/Support/MemoryUsage.cpp
AgeCommit message (Collapse)Author
2017-01-19Fix `Feature/MemoryLimit.c` test when building KLEE with ASan.Dan Liew
When building with ASan the `mallinfo()` function is intercepted. However the currently implementation is just a stub that always returns 0. So instead use the public API of the sanitizer runtime to get the amount of currently allocated memory when KLEE is built with ASan. Unfortunately it appears that the way to detect building with ASan differs between Clang and GCC. There was also a sanitizer runtime API change too. This was tested with * Clang 3.4, 3.5, and 3.9.0 * GCC 4.8, 4.9, 5.2, 5.4 and, 6.2.1.
2016-08-02MemoryUsage: fix GetTotalMallocUsageJiri Slaby
The mallinfo() interface is ill-designed. It returns 'int' as occupied memory. This means at most 2G. This causes troubles when capping the memory to 3G by -max-memory=3000 for example. We cannot fix the interface, but we can at least extend the space to 4G. So cast those 'int's to 'unsigned int's to avoid sign extension. Then do the addition on 'size_t' to count on 64bit values (on 64 bit). Apart from that, the original 'int' + 'int' led to overflow which is undefined on 'signed int's in C. Also, when klee is run under valgrind, generic.current_allocated_bytes from gperftools does not touch the passed pointer and in that case, we return garbage from GetTotalMallocUsage. So initialize 'value' to 0 to avoid the problem. And since GetNumericProperty accepts 'size_t', let's define 'value' as such. It was 'uint64_t' previously and they differ on 32 bit. Signed-off-by: Jiri Slaby <jslaby@suse.cz>
2016-02-27Add support for tcmallocMartin Nowack
Beside improving performance of KLEE, tcmalloc allows to track used memory correctly. If available, tcmalloc is automatically used during compile time. This can be forced to be: - disabled using --without-tcmalloc - enabled using --with-tcmalloc In the second case, configure will fail if tcmalloc is not found or usable. Both versions of tcmalloc a minimal and normal version.
2014-09-12Add support for getting memory usage on Darwin.Daniel Dunbar
2014-09-12Do not require mallinfo(), which is Linux specific.Daniel Dunbar
2014-04-24Renamed GetTotalMemoryUsage to GetTotalMallocUsageMartin Nowack
2014-04-24Modify klee::util::GetTotalMemoryUsage() so that if the system isDan Liew
not using glibc the malloc usage if computed differently.
2014-04-24Fix handling of memory usage in KLEE.Martin Nowack
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.