https://bugs.kde.org/show_bug.cgi?id=368507
Bug ID: 368507 Summary: valgrind throws std::bad_alloc on memory allocations larger than 34255421416 bytes Product: valgrind Version: 3.10.0 Platform: RedHat RPMs OS: Linux Status: UNCONFIRMED Severity: crash Priority: NOR Component: general Assignee: jsew...@acm.org Reporter: tgra...@umiacs.umd.edu Memory allocations of 34255421417 and higher cause a std::bad_alloc exception to be thrown when running a process with valgrind even though the process runs fine on it's own. This is not a memory overhead issue since I've run this on a machine with >250GB free memory and a machine with <50GB free memory and had the same results. If the allocation is lowered to 34255421416 the exception is not thrown. -bash-4.2$ cat test.cpp /* Hello World program */ #include<iostream> #include <stdio.h> #include <unistd.h> using namespace std; typedef struct test test; struct test { char arr[34255421417] = {}; }; int main() { cout << "Before Allocation\n"; try{ test * t1 = new test; }catch(const std::exception &exc){ std::string exception = exc.what(); std::cerr << "Caught exception: " + exception + "\n"; } cout << "After Allocation\n"; cin.get(); return 0; } -bash-4.2$ g++ -std=c++11 test.cpp -bash-4.2$ valgrind --tool=cachegrind ./a.out ==43814== Cachegrind, a cache and branch-prediction profiler ==43814== Copyright (C) 2002-2013, and GNU GPL'd, by Nicholas Nethercote et al. ==43814== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info ==43814== Command: ./a.out ==43814== --43814-- warning: L3 cache found, using its data for the LL simulation. Before Allocation Caught exception: std::bad_alloc After Allocation ==43814== ==43814== I refs: 1,477,163 ==43814== I1 misses: 1,756 ==43814== LLi misses: 1,683 ==43814== I1 miss rate: 0.11% ==43814== LLi miss rate: 0.11% ==43814== ==43814== D refs: 499,289 (371,405 rd + 127,884 wr) ==43814== D1 misses: 12,494 ( 10,762 rd + 1,732 wr) ==43814== LLd misses: 7,472 ( 6,209 rd + 1,263 wr) ==43814== D1 miss rate: 2.5% ( 2.8% + 1.3% ) ==43814== LLd miss rate: 1.4% ( 1.6% + 0.9% ) ==43814== ==43814== LL refs: 14,250 ( 12,518 rd + 1,732 wr) ==43814== LL misses: 9,155 ( 7,892 rd + 1,263 wr) ==43814== LL miss rate: 0.4% ( 0.4% + 0.9% ) -bash-4.2$ ./a.out Before Allocation After Allocation -bash-4.2$ free -g total used free shared buff/cache available Mem: 251 2 33 0 215 248 Swap: 3 0 3 -bash-4.2$ valgrind --version valgrind-3.10.0 -- You are receiving this mail because: You are watching all bug changes.