MemFree

 (Available in 00 TS Tools(Base) - TS_Tools_PointerSafe)

Purpose

Set the 'MemFree' flag

Syntax

oPointerSafe:MemFree:=TRUE

Arguments

lMemFree
LOGIC

Description

If the 'MemFree' property of the object is TRUE ( this is the default ) then allocated memory will be freed when the object is removed from scope ( e.g. when 'Axit()' is executed ).

Example

METHOD ReAlloc( dwItemMax AS DWORD ) AS LOGIC PASCAL CLASS TS_PointerSafe
LOCAL oPointerSafe AS TS_PointerSafe
   oPointerSafe:=TS_PointerSafe{ SELF:Owner, dwItemMax, SELF:ItemSize  ; ...
  ... }
   MemCopy( oPointerSafe:BytesPointer
   , SELF:BytesPointer
   , Min( oPointerSafe:BytesAllocated, SELF:BytesAllocated  ; ...
  ... ) )
   MemFree( SELF:_BytesPointer )
   SELF:_BytesAllocated:=oPointerSafe:BytesAllocated
   SELF:_BytesPointer:=oPointerSafe:BytesPointer
   oPointerSafe:MemFree:=FALSE
   oPointerSafe:Axit( )
   oPointerSafe:=NULL_OBJECT
RETURN lRetVal

Source

ASSIGN MemFree( lMemFree AS LOGIC ) AS LOGIC PASCAL CLASS TS_PointerSafe
   TSTrace Enter
   SELF:_MemFree:=lMemFree
   TSTrace Leave
RETURN SELF:_MemFree