mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-11-10 00:47:31 +03:00
eliminate spurious copy / memory leak
This commit is contained in:
parent
60cae6418f
commit
7123d1cc80
@ -80,12 +80,12 @@ void ChartRuleLookupManagerMemory::GetChartRuleCollection(
|
||||
}
|
||||
|
||||
// copy temporarily stored rules to out collection
|
||||
CompletedRuleCollection rules = m_completedRules[absEndPos];
|
||||
CompletedRuleCollection & rules = m_completedRules[absEndPos];
|
||||
for (vector<CompletedRule*>::const_iterator iter = rules.begin(); iter != rules.end(); ++iter) {
|
||||
outColl.Add((*iter)->GetTPC(), (*iter)->GetStackVector(), range);
|
||||
}
|
||||
|
||||
m_completedRules[absEndPos].Clear();
|
||||
rules.Clear();
|
||||
|
||||
}
|
||||
|
||||
|
@ -80,12 +80,12 @@ void ChartRuleLookupManagerMemoryPerSentence::GetChartRuleCollection(
|
||||
}
|
||||
|
||||
// copy temporarily stored rules to out collection
|
||||
CompletedRuleCollection rules = m_completedRules[absEndPos];
|
||||
CompletedRuleCollection & rules = m_completedRules[absEndPos];
|
||||
for (vector<CompletedRule*>::const_iterator iter = rules.begin(); iter != rules.end(); ++iter) {
|
||||
outColl.Add((*iter)->GetTPC(), (*iter)->GetStackVector(), range);
|
||||
}
|
||||
|
||||
m_completedRules[absEndPos].Clear();
|
||||
rules.Clear();
|
||||
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,11 @@ CompletedRuleCollection::CompletedRuleCollection() : m_ruleLimit(StaticData::Ins
|
||||
m_scoreThreshold = numeric_limits<float>::infinity();
|
||||
}
|
||||
|
||||
CompletedRuleCollection::~CompletedRuleCollection()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
// copies some functionality (pruning) from ChartTranslationOptionList::Add
|
||||
void CompletedRuleCollection::Add(const TargetPhraseCollection &tpc,
|
||||
const StackVec &stackVec,
|
||||
|
@ -75,6 +75,7 @@ struct CompletedRuleCollection {
|
||||
public:
|
||||
|
||||
CompletedRuleCollection();
|
||||
~CompletedRuleCollection();
|
||||
|
||||
CompletedRuleCollection(const CompletedRuleCollection &old)
|
||||
: m_collection(old.m_collection)
|
||||
|
Loading…
Reference in New Issue
Block a user