Skip to content

Commit

Permalink
use data ptrs clone/free funcs only in schemas with data ptr atts
Browse files Browse the repository at this point in the history
  • Loading branch information
glookka committed Apr 23, 2023
1 parent 754ba59 commit 979fa27
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/schema/helper.cpp
Expand Up @@ -100,11 +100,17 @@ void CSphSchemaHelper::ResetSchemaHelper()

void CSphSchemaHelper::CloneMatch ( CSphMatch& tDst, const CSphMatch& rhs ) const
{
CloneMatchSpecial ( tDst, rhs, m_dDataPtrAttrs );
if ( m_dDataPtrAttrs.GetLength() )
CloneMatchSpecial ( tDst, rhs, m_dDataPtrAttrs );
else
tDst.Combine ( rhs, GetDynamicSize() );
}

void CSphSchemaHelper::FreeDataPtrs ( CSphMatch& tMatch ) const
{
if ( !m_dDataPtrAttrs.GetLength() )
return;

FreeDataSpecial ( tMatch, m_dDataPtrAttrs );
}

Expand Down
8 changes: 6 additions & 2 deletions src/sphinxsort.cpp
Expand Up @@ -2285,8 +2285,11 @@ struct MatchCloner_t
// memorize old dynamic first
memcpy ( m_dRowBuf.Begin(), tDst.m_pDynamic, m_dRowBuf.GetLengthBytes() );

m_pSchema->FreeDataSpecial ( tDst, m_dOtherPtrRows );
m_pSchema->CloneMatchSpecial ( tDst, tSrc, m_dOtherPtrRows );
if ( m_dOtherPtrRows.GetLength() )
{
m_pSchema->FreeDataSpecial ( tDst, m_dOtherPtrRows );
m_pSchema->CloneMatchSpecial ( tDst, tSrc, m_dOtherPtrRows );
}

/*
FreeDataSpecial ( tDst, m_dOtherPtrRows );
Expand Down Expand Up @@ -2718,6 +2721,7 @@ class KBufferGroupSorter_T : public CSphMatchQueueTraits, protected BaseGroupSor
{
if_const ( NOTIFICATIONS && bNotify )
m_dJustPopped.Add ( RowTagged_t ( m_dData[iMatch] ) );

m_pSchema->FreeDataPtrs ( m_dData[iMatch] );

// on final pass we totally wipe match.
Expand Down

0 comments on commit 979fa27

Please sign in to comment.