Solved! As noted in the comments on this question, this was a problem caused by some kind of memory corruption. As I said, I used the memory checher (valgrind) and found out that it was a really stupid mistake: I just forgot to initialize the variable in a for loop, something like
for (int i; i < limit ; i++)
and this led to this strange error :-) Initialization I solved the problem until 0, and now the program works with the Parser object, placed either on the stack or in the heap.
Therefore, I suggest that others who encounter similar problems use a memory tester to control the memory usage of their program. Using valgrind is very simple:
valgrind --leak-check=yes yourProgram arg1 arg2
where arg1 and arg2 are the (possible) arguments that your program requires.
Besides compiling your program using the -g flag (at least in g ++, I don't know other compilers), valgrind will also tell you about which line of code the memory leak has occurred.
Thank you all for your help!
respectfully
Matteo
source share