freeMemory
Short summary
This method is used to free allocated memory if needed
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| stringAddress | POINTER TO BYTE | start address of the memory to free | input |
| freeAllocatedMemory | BOOL | TRUE means free the memory, FALSE means do not free the memory | input |
Code
Declaration
METHOD PROTECTED freeMemory
VAR_INPUT
(* start address of the memory to free *)
stringAddress :POINTER TO BYTE;
(* ``TRUE`` means free the memory, ``FALSE`` means do not free the memory *)
freeAllocatedMemory :BOOL;
END_VAR
Implementation
IF (freeAllocatedMemory) THEN
__DELETE(stringAddress);
END_IF