示例#1
0
/*
 * This function decreases the number of references to passed global value.
 * If it is the last reference then this value is deleted.
 */
void hb_memvarValueDecRef( PHB_ITEM pMemvar )
{
   HB_TRACE( HB_TR_DEBUG, ( "hb_memvarValueDecRef(%p)", pMemvar ) );

   if( hb_xRefDec( pMemvar ) )
   {
      if( HB_IS_COMPLEX( pMemvar ) )
         hb_itemClear( pMemvar );
      hb_xfree( pMemvar );
   }
}
示例#2
0
void hb_gcGripDrop( HB_ITEM_PTR pItem )
{

   HB_TRACE( HB_TR_DEBUG, ( "hb_gcGripDrop(%p)", pItem ) );

   if( hb_gc_bReleaseAll )
   {
      HB_TRACE( HB_TR_DEBUG, ( "Aborted - hb_gcGripDrop(%p)", pItem ) );
      return;
   }

   if( pItem )
   {
      HB_GARBAGE_PTR pAlloc = ( HB_GARBAGE_PTR ) pItem;
      --pAlloc;

      HB_TRACE( HB_TR_INFO, ( "Drop %p %p", pItem, pAlloc ) );

      if( pAlloc->pFunc == hb_gcGripRelease )
      {
         if( HB_IS_COMPLEX( pItem ) )
         {
            hb_itemClear( pItem );    /* clear value stored in this item */
         }
      }

      HB_CRITICAL_LOCK( hb_garbageAllocMutex );

      hb_gcUnlink( &s_pLockedBlock, pAlloc );

      HB_CRITICAL_UNLOCK( hb_garbageAllocMutex );

      HB_GARBAGE_FREE( pAlloc );
   }

}
示例#3
0
文件: garbage.c 项目: JamesLinus/core
static HB_GARBAGE_FUNC( hb_gcGripRelease )
{
   if( HB_IS_COMPLEX( ( PHB_ITEM ) Cargo ) )
      hb_itemClear( ( PHB_ITEM ) Cargo );
}