void _NamedByteArray_Init ( NamedByteArray * nba, byte * name, int32 size, int32 atype ) { _Symbol_Init ( (Symbol*) nba, name ) ; nba->NBA_AType = atype ; nba->BA_MemoryList = _DLList_New ( OPENVMTIL ) ; nba->NBA_Size = size ; nba->MemInitial = size ; nba->NumberOfByteArrays = 0 ; _NamedByteArray_AddNewByteArray ( nba, size ) ; }
void OVT_MemList_FreeNBAMemory ( byte * name, uint32 moreThan, int32 always ) { NamedByteArray *nba = _OVT_Find_NBA ( name ) ; if ( always || ( nba->MemAllocated > ( nba->MemInitial + moreThan ) ) ) // this logic is fuzzy ?? what is wanted is a way to fine tune mem allocation { NBAsMemList_FreeExactType ( nba->NBA_AProperty ) ; nba->MemAllocated = 0 ; nba->MemRemaining = 0 ; _NamedByteArray_AddNewByteArray ( nba, nba->NBA_Size ) ; } }
void OVT_MemList_FreeNBAMemory ( byte * name, uint32 moreThan, int32 always ) { #if 1 // ?!? how much do we need this at all ?!? NamedByteArray *nba = _OVT_Find_NBA ( name ) ; if ( always || ( nba->MemAllocated > ( nba->MemInitial + moreThan ) ) ) { NBAsMemList_FreeExactType ( nba->NBA_AType ) ; nba->MemAllocated = 0 ; nba->MemRemaining = 0 ; _NamedByteArray_AddNewByteArray ( nba, nba->NBA_Size ) ; } #endif }
void NBA_FreeChunkType ( Symbol * s, uint32 allocType, int32 exactFlag ) { NamedByteArray * nba = Get_NBA_Symbol_To_NBA ( s ) ; if ( exactFlag ) { if ( nba->NBA_AProperty != allocType ) return ; } else if ( ! ( nba->NBA_AProperty & allocType ) ) return ; FreeNbaList ( nba ) ; nba->MemRemaining = 0 ; nba->MemAllocated = 0 ; _NamedByteArray_AddNewByteArray ( nba, nba->NBA_Size ) ; }
byte * _ByteArray_AppendSpace ( ByteArray * array, int32 size ) // size in bytes { NamedByteArray * nba = array->OurNBA ; tryAgain: array->StartIndex = array->EndIndex ; // move index to end of the last append array->EndIndex += size ; if ( array->EndIndex >= array->bp_Last ) { if ( nba ) { if ( nba->NBA_AType == CODE ) { Error_Abort ( ( byte* ) "\nOut of Code Memory : Set Code Memory size higher at startup.\n" ) ; } _NamedByteArray_AddNewByteArray ( nba, size ) ; array = nba->ba_ByteArray ; goto tryAgain ; } } if ( nba ) nba->MemRemaining -= size ; //nb. debugger->StepInstructionBA doesn't have an nba return array->StartIndex ; }