gcov out of memory / mismatched version?

Chris Bolton picture Chris Bolton · Sep 17, 2012 · Viewed 15.7k times · Source

Just trying to get gcov up and running, getting the following error:

$ gcov src/main.c -o build
build/main.gcno:version '404*', prefer '407*'

gcov: out of memory allocating 14819216480 bytes after a total of 135168 bytes

I'm using clang/profile_rt to generate the files gcov needs, I'm assuming that might have something to do with it. It's working on my other computer, though, so I assume it can be fixed somehow.

Answer

Anthony Sottile picture Anthony Sottile · Feb 3, 2013

I just had the same problem on my machine.

Make sure your versions of gcov and the compiler you use match.

I had this exact problem when compiling with g++-4.7 and I had gcov 4.6.

On my machine sudo apt-get install ggcov got me the latest version. I then had to sudo ln -sf /usr/bin/gcov-4.7 /usr/bin/gcov to make gcov point in the right place.