ChangeLog 2000-07-16 19:00 UTC+0100

This commit is contained in:
Ryszard Glab
2000-07-16 16:55:37 +00:00
parent f3fd7233db
commit 1337925fae
4 changed files with 26 additions and 7 deletions

View File

@@ -1,3 +1,14 @@
2000-07-16 19:00 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
*include/hbapi.h
*source/vm/hvm.c
*source/vm/memvars.c
* memvars table is deleted in two steps: first clear all
public and private variables (without the detached variables)
and next free space allocated for memvars table. These two steps
are separated with the garbage collector call so self
referencing variables will be deallocated properly.
2000-07-16 17:40 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
*include/hbhash.h

View File

@@ -439,7 +439,8 @@ extern void hb_codeblockCopy( PHB_ITEM pDest, PHB_ITEM pSource ); /* copy a
extern HB_HANDLE hb_memvarValueNew( HB_ITEM_PTR pSource, BOOL bTrueMemvar ); /* create a new global value */
extern HB_VALUE_PTR * hb_memvarValueBaseAddress( void ); /* retrieve the base address of the values table */
extern void hb_memvarsInit( void ); /* initialize the memvar API system */
extern void hb_memvarsRelease( void ); /* release the memvar API system */
extern void hb_memvarsRelease( void ); /* clear all PUBLIC and PRIVATE variables */
extern void hb_memvarsFree( void ); /* release the memvar API system */
extern void hb_memvarValueIncRef( HB_HANDLE hValue ); /* increase the reference count of a global value */
extern void hb_memvarValueDecRef( HB_HANDLE hValue ); /* decrease the reference count of a global value */
extern void hb_memvarSetValue( PHB_SYMB pMemvarSymb, HB_ITEM_PTR pItem ); /* copy an item into a symbol */

View File

@@ -356,11 +356,12 @@ void hb_vmQuit( void )
hb_stackPop();
hb_itemClear( &hb_stack.Return );
hb_arrayRelease( &s_aStatics );
hb_memvarsRelease();
hb_memvarsRelease(); /* clear all PUBLIC variables */
/* release all known garbage */
hb_gcCollectAll();
hb_memvarsFree(); /* free memory allocated for memvars table */
hb_stackFree();
/* hb_dynsymLog(); */
hb_xexit();

View File

@@ -96,27 +96,33 @@ void hb_memvarsInit( void )
s_privateStackCnt = s_privateStackBase = 0;
}
/* clear all variables except the detached ones
* Should be called at application exit only
*/
void hb_memvarsRelease( void )
{
ULONG ulCnt = s_globalLastFree;
HB_TRACE(HB_TR_DEBUG, ("hb_memvarsRelease()"));
HB_TRACE(HB_TR_DEBUG, ("hb_memvarsClear()"));
if( s_globalTable )
{
while( ulCnt )
{
if( s_globalTable[ ulCnt ].counter )
if( s_globalTable[ ulCnt ].counter && s_globalTable[ ulCnt ].hPrevMemvar != ( HB_HANDLE )-1 )
{
hb_itemClear( &s_globalTable[ ulCnt ].item );
s_globalTable[ ulCnt ].counter = 0;
}
--ulCnt;
}
hb_xfree( s_globalTable );
s_globalTable = NULL;
}
}
void hb_memvarsFree( void )
{
if( s_globalTable )
hb_xfree( s_globalTable );
if( s_privateStack )
hb_xfree( s_privateStack );