diff options
author | Jiri Slaby <jslaby@suse.cz> | 2016-08-01 19:12:26 +0200 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2016-08-02 10:57:02 +0200 |
commit | 47cd9b3030b2cda212209dd9e282274d0d7547f0 (patch) | |
tree | ce722a48fb100698b5cb7fed6d68bacccd74d624 /lib/Core | |
parent | 66adc6374cc9b43db2beccec9ae0a547dc411eae (diff) | |
download | klee-47cd9b3030b2cda212209dd9e282274d0d7547f0.tar.gz |
MemoryUsage: fix GetTotalMallocUsage
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>
Diffstat (limited to 'lib/Core')
0 files changed, 0 insertions, 0 deletions