diff --git a/contrib/other-builds/moses2/LM/KENLM.cpp b/contrib/other-builds/moses2/LM/KENLM.cpp index 97cc2a0a2..2bfa63179 100644 --- a/contrib/other-builds/moses2/LM/KENLM.cpp +++ b/contrib/other-builds/moses2/LM/KENLM.cpp @@ -101,14 +101,14 @@ void KENLM::Load(System &system) void KENLM::InitializeForInput(const Manager &mgr) const { - CacheColl &cache = GetCache(); - cache.clear(); - mgr.lmCache = &cache; + mgr.lmCache = new CacheColl(); } // clean up temporary memory, called after processing each sentence void KENLM::CleanUpAfterSentenceProcessing(const Manager &mgr) const { + CacheColl *lmCache = (CacheColl*)mgr.lmCache; + delete lmCache; } void KENLM::SetParameter(const std::string& key, const std::string& value) @@ -340,10 +340,5 @@ const KENLM::LMCacheValue &KENLM::ScoreAndCache(const Manager &mgr, const lm::ng return *val; } -KENLM::CacheColl &KENLM::GetCache() const -{ - return GetThreadSpecificObj(m_cache); -} - } diff --git a/contrib/other-builds/moses2/LM/KENLM.h b/contrib/other-builds/moses2/LM/KENLM.h index f55f44232..9d4cad3e1 100644 --- a/contrib/other-builds/moses2/LM/KENLM.h +++ b/contrib/other-builds/moses2/LM/KENLM.h @@ -96,9 +96,6 @@ protected: lm::WordIndex *LastIDs(const Hypothesis &hypo, lm::WordIndex *indices) const; const LMCacheValue &ScoreAndCache(const Manager &mgr, const lm::ngram::State &in_state, const lm::WordIndex new_word) const; - - CacheColl &GetCache() const; - }; }