Giter Site home page Giter Site logo

gcov error:std::bad_alloc about lcov HOT 7 OPEN

Jeling-W avatar Jeling-W commented on June 29, 2024
gcov error:std::bad_alloc

from lcov.

Comments (7)

henry2cox avatar henry2cox commented on June 29, 2024

You didn't say what compiler and version(s) you used, your platform, or even the source language of your example.
If it fails with the newest GCC - maybe you can try LLVM (either gcov or profdata path).
You can execute gcov with different flags to see what makes it unhappy.
Similarly, you can modify your source code (e.g., by stubbing our some functions) - to possibly narrow down the issue.

Sounds a lot like out of memory. How do you know that your system's memory is sufficient?
Could also be a bug in gcov - trying to allocate an unreasonably large buffer.

In any event: you have not provided enough information for anyone to be able to help you.

from lcov.

Jeling-W avatar Jeling-W commented on June 29, 2024

When using gcov version 8.3.0 paired with lcov 1.13 or gcov 9.4.0 paired with lcov 2.0 to process main.cpp, an error is encountered:

terminate called after throwing an instance of 'std::bad_alloc'  
        what(): std::bad_alloc

When using gcov version 4.8.0 to process main.cpp, a different error is encountered:
main.gcno no functions found

After using gcov 4.8.0 to execute: gcov main.cpp, there will be some prompts for main. cpp: no lines for, but the main. cpp.gcov file can still be generated normally,

using gcov8.3 or gcov9.4 to execute: gcov main.cpp, the error is encountered:

terminate called after throwing an instance of 'std::bad_alloc'  
        what(): std::bad_alloc
Aborted (core dumped)

The same compilation process and generation coverage process are fine in the func.cpp file

from lcov.

henry2cox avatar henry2cox commented on June 29, 2024

Current gcc version is 13.
gcc/4.8 is about 10 years old and 8.3 is more than 5.
I suggest to upgrade.

This isn't an lcov bug - but the same observation applies. Current 'release' version is 2.1. lcov/1.13 predates move to github - and is really, really old.
Pretty sure that lcov/2.1 and 2.0 both support gcc/4.X (but not older than 4) - so you may be able to use that, if you really cannot upgrade. Sounds like the gcov-extracted data is not completely correct, though.
You could also just exclude the offending file from processing (losing that compilation unit from the coverage report).

from lcov.

Jeling-W avatar Jeling-W commented on June 29, 2024

Is it possible that there is an error in the content of my gcda and gcno?

from lcov.

henry2cox avatar henry2cox commented on June 29, 2024

Anything is possible.
An error in the compile-time data (gcno) would be a compiler bug.
An error in the runtime data (gcda) would either be a compiler or C/C++ runtime bug.
Or this could be a bug in gcov.
If you really want to diagnose it: then you will need to do some experiments - and probably need the source code for the toolchain components so you can see what they are doing.
Or you could upgrade and hope it goes away.
Or you could upgrade - discover that there is still an issue - and then debug more recent toolchain code.

Not sure your affiliation or interests - but if you happen to be a computer science or software engineering student somewhere, then this could be a really excellent learning experience: track down a fix a real bug in a nontrivial framework.
I guarantee you that you would learn a lot. (I guarantee you that I would learn a lot.)

from lcov.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.