bonjour,

alors j'ai un soucis, lorsque je debug mon code ci dessous :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
void CSVParser::checkDataContent()
{
    ILogger *logger = initLogger(INFO, true);
 
    std::vector<std::string> data;
    data.resize(m_data.size());
    data=m_data;
 
    //Create the vector that begin at the index 2 of the data vector.
    if(!data.empty())
    {
        auto start = std::next(data.begin(), 2);
        std::vector<std::string> sub_data(start, data.end());
        for (auto &it: sub_data)
        {
            try
            {
                std::stod(it);
            }
            catch (const std::exception &e)
            {
                logger->Log(ERROR, it + " cannot be converted to a double");
            }
        }
    }
}
sous gdb j'ai ce message d'erreur :

<error: Cannot access memory at address 0x10176672000000>
Le soucis vient du J'ai teste sous Valgrind pour voir si j'avais des fuites mémoire, mais le rapport Valgrind ne donne rien.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
valgrind --tool=memcheck --gen-suppressions=all --leak-check=full --leak-resolution=med --track-origins=yes --vgdb=no ./build/main
==89679== Memcheck, a memory error detector
==89679== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==89679== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==89679== Command: ./build/main
==89679==
==89679== HEAP SUMMARY:
==89679== in use at exit: 16 bytes in 1 blocks
==89679== total heap usage: 88 allocs, 87 frees, 106,168 bytes allocated
==89679==
==89679== LEAK SUMMARY:
==89679== definitely lost: 0 bytes in 0 blocks
==89679== indirectly lost: 0 bytes in 0 blocks
==89679== possibly lost: 0 bytes in 0 blocks
==89679== still reachable: 16 bytes in 1 blocks
==89679== suppressed: 0 bytes in 0 blocks
==89679== Reachable blocks (those to which a pointer was found) are not shown.
==89679== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==89679==
==89679== For lists of detected and suppressed errors, rerun with: -s
==89679== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Est ce que vous auriez une idée du problème ?

Merci d'avance.