From 0fceee613ba29b9bd358e089b64f27a5327b359a Mon Sep 17 00:00:00 2001 From: Brian Cochran Date: Wed, 29 Mar 2023 11:00:20 -0400 Subject: [PATCH 1/2] add a check for FSA memory full --- cpp/fsa.h | 2 ++ cpp/stlastar.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cpp/fsa.h b/cpp/fsa.h index dceaf55..976f075 100755 --- a/cpp/fsa.h +++ b/cpp/fsa.h @@ -236,6 +236,8 @@ template class FixedSizeAllocator ); } + unsigned int GetMaxElementCount(){ return m_MaxElements; }; + public: // data private: // methods diff --git a/cpp/stlastar.h b/cpp/stlastar.h index e74e4ec..995be7b 100755 --- a/cpp/stlastar.h +++ b/cpp/stlastar.h @@ -197,10 +197,16 @@ template class AStarSearch return m_State; } + bool maxNodesReached = false; + #if USE_FSA_MEMORY + maxNodesReached = m_AllocateNodeCount >= m_FixedSizeAllocator.GetMaxElementCount(); + #endif + // Failure is defined as emptying the open list as there is nothing left to // search... - // New: Allow user abort - if( m_OpenList.empty() || m_CancelRequest ) + // Allow user abort + // Check if FSA memory is full + if( m_OpenList.empty() || m_CancelRequest || maxNodesReached) { FreeAllNodes(); m_State = SEARCH_STATE_FAILED; From 1525383de1ebf998d446f45e62acd445328891e2 Mon Sep 17 00:00:00 2001 From: Brian Cochran Date: Wed, 29 Mar 2023 11:01:53 -0400 Subject: [PATCH 2/2] formatting --- cpp/fsa.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/fsa.h b/cpp/fsa.h index 976f075..f472af7 100755 --- a/cpp/fsa.h +++ b/cpp/fsa.h @@ -236,7 +236,7 @@ template class FixedSizeAllocator ); } - unsigned int GetMaxElementCount(){ return m_MaxElements; }; + unsigned int GetMaxElementCount() { return m_MaxElements; }; public: // data