vendredi 1 juillet 2016

Segmentation fault during a function call from a non-reference std::vector parameter

At a certain point in my program, I am getting a segmentation fault when I call any function with a by-value std::vector<some_type> parameter. I don't get the error if parameter is by-reference. When I inspect the debugger, I see that it originates from the std::string data member of some_type.

I am unable to demonstrate the problem, so I don't expect any specific answers. I do however appreciate suggestions to get me closer to finding the source of it.

Here is a bit of context: I have an logical expression parser. The expressions can contain arithmetical expressions, late-bind variables and function calls. Given such an expression, parser creates a tree with nodes of several types. Parse stage is always successful. I have the problem in evaluation stage.

Evaluation stage is destructive to the tree structure, so the its nodes are "restored" using a backup copy before each evaluation. 1st evaluation is also always successful. I'm having the problem immediately after that, with some certain expressions. Even then, the error is not consistent.

Please assume that I have no memory leaks and double releases. (I am using an global new() overload to track allocations/deallocations.)

Any ideas on how I should tackle this?

Aucun commentaire:

Enregistrer un commentaire