You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we found memory-leak in LexerATNSimulator::computeTargetState
dfa::DFAState *LexerATNSimulator::computeTargetState(CharStream *input, dfa::DFAState *s, size_t t) {
OrderedATNConfigSet *reach = newOrderedATNConfigSet(); /* mem-check: deleted on error or managed by new DFA state. */// if we don't find an existing DFA state// Fill reach starting from closure, following t transitionsgetReachableConfigSet(input, s->configs.get(), reach, t);
if (reach->isEmpty()) { // we got nowhere on t from sif (!reach->hasSemanticContext) {
// we got nowhere on t, don't throw out this knowledge; it'd// cause a failover from DFA later.delete reach;
addDFAEdge(s, t, ERROR.get());
}
// stop when we can't match any more charreturn ERROR.get();
}
// Add an edge from s to target DFA found/created for reachreturnaddDFAEdge(s, t, reach);
}
after my modify:only add delete reach
dfa::DFAState *LexerATNSimulator::computeTargetState(CharStream *input, dfa::DFAState *s, size_t t) {
OrderedATNConfigSet *reach = newOrderedATNConfigSet(); /* mem-check: deleted on error or managed by new DFA state. */// if we don't find an existing DFA state// Fill reach starting from closure, following t transitionsgetReachableConfigSet(input, s->configs.get(), reach, t);
if (reach->isEmpty()) { // we got nowhere on t from sif (!reach->hasSemanticContext) {
// we got nowhere on t, don't throw out this knowledge; it'd// cause a failover from DFA later.delete reach;
addDFAEdge(s, t, ERROR.get());
} else {
delete reach; // <<--------------------------- we modify here
}
// stop when we can't match any more charreturn ERROR.get();
}
// Add an edge from s to target DFA found/created for reachreturnaddDFAEdge(s, t, reach);
}
now, memory-leak disappear.
Due to the big grammar size and company policy, we can't provide the test grammar.
Sorry for that.
Is the above modifications reasonable and the best?
The text was updated successfully, but these errors were encountered:
after my modify:only add
delete reach
now, memory-leak disappear.
Due to the big grammar size and company policy, we can't provide the test grammar.
Sorry for that.
Is the above modifications reasonable and the best?
The text was updated successfully, but these errors were encountered: