From f7ec2ee09a80446969bb1dcd3afb56aea7ec3a2e Mon Sep 17 00:00:00 2001 From: germann Date: Mon, 24 Mar 2014 10:55:47 +0000 Subject: [PATCH] 1. Fixed order of initializations in constructor so gcc won't complain. 2. Added call to PhraseDictionary.release(TargetPhraseCollection*) to release used TargetPhraseCollection's. --- moses/InputPath.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/moses/InputPath.cpp b/moses/InputPath.cpp index 786cfa8a4..7a6464aac 100644 --- a/moses/InputPath.cpp +++ b/moses/InputPath.cpp @@ -5,7 +5,7 @@ #include "TypeDef.h" #include "AlignmentInfo.h" #include "util/exception.hh" - +#include "TranslationModel/PhraseDictionary.h" using namespace std; namespace Moses @@ -18,8 +18,8 @@ InputPath(const Phrase &phrase, const NonTerminalSet &sourceNonTerms, ,m_phrase(phrase) ,m_range(range) ,m_inputScore(inputScore) - ,m_sourceNonTerms(sourceNonTerms) ,m_nextNode(1) + ,m_sourceNonTerms(sourceNonTerms) { //cerr << "phrase=" << phrase << " m_inputScore=" << *m_inputScore << endl; @@ -27,6 +27,14 @@ InputPath(const Phrase &phrase, const NonTerminalSet &sourceNonTerms, InputPath::~InputPath() { + // Since there is no way for the Phrase Dictionaries to tell in + // which (sentence) context phrases were looked up, we tell them + // now that the phrase isn't needed any more by this inputPath + typedef std::pair entry; + std::map::const_iterator iter; + for (iter = m_targetPhrases.begin(); iter != m_targetPhrases.end(); ++iter) + iter->first->release(iter->second.first); + delete m_inputScore; }