From 46d459f445f06d7857470184fb32ee99d3cb0264 Mon Sep 17 00:00:00 2001 From: Hieu Hoang Date: Mon, 3 Oct 2016 17:14:35 +0100 Subject: call CleanUpAfterSentenceProcessing() --- contrib/moses2/FF/FeatureFunction.h | 2 +- contrib/moses2/FF/FeatureFunctions.cpp | 7 +++++++ contrib/moses2/FF/FeatureFunctions.h | 2 ++ contrib/moses2/ManagerBase.cpp | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/contrib/moses2/FF/FeatureFunction.h b/contrib/moses2/FF/FeatureFunction.h index 20d8b520d..d38c72b89 100644 --- a/contrib/moses2/FF/FeatureFunction.h +++ b/contrib/moses2/FF/FeatureFunction.h @@ -106,7 +106,7 @@ public: } // clean up temporary memory, called after processing each sentence - virtual void CleanUpAfterSentenceProcessing() + virtual void CleanUpAfterSentenceProcessing() const { } diff --git a/contrib/moses2/FF/FeatureFunctions.cpp b/contrib/moses2/FF/FeatureFunctions.cpp index 4eb0d9a3a..53eb0f351 100644 --- a/contrib/moses2/FF/FeatureFunctions.cpp +++ b/contrib/moses2/FF/FeatureFunctions.cpp @@ -210,6 +210,13 @@ void FeatureFunctions::EvaluateWhenAppliedBatch(const Batch &batch) const } } +void FeatureFunctions::CleanUpAfterSentenceProcessing() const +{ + BOOST_FOREACH(const FeatureFunction *ff, m_featureFunctions) { + ff->CleanUpAfterSentenceProcessing(); + } +} + void FeatureFunctions::ShowWeights(const Weights &allWeights) { BOOST_FOREACH(const FeatureFunction *ff, m_featureFunctions) { diff --git a/contrib/moses2/FF/FeatureFunctions.h b/contrib/moses2/FF/FeatureFunctions.h index 9d25f1dba..74c77c7e6 100644 --- a/contrib/moses2/FF/FeatureFunctions.h +++ b/contrib/moses2/FF/FeatureFunctions.h @@ -81,6 +81,8 @@ public: void EvaluateWhenAppliedBatch(const Batch &batch) const; + void CleanUpAfterSentenceProcessing() const; + void ShowWeights(const Weights &allWeights); protected: diff --git a/contrib/moses2/ManagerBase.cpp b/contrib/moses2/ManagerBase.cpp index 6d7dbc6b1..1e774cc5b 100644 --- a/contrib/moses2/ManagerBase.cpp +++ b/contrib/moses2/ManagerBase.cpp @@ -34,6 +34,8 @@ ManagerBase::ManagerBase(System &sys, const TranslationTask &task, ManagerBase::~ManagerBase() { + system.featureFunctions.CleanUpAfterSentenceProcessing(); + if (m_pool) { GetPool().Reset(); } -- cgit v1.2.3