free - Deallocate Memory Block

VAX11

 

free - Deallocate Memory Block

 

free deallocates the previously allocated memory block pointed to by 'Ptr'.

The block must have been allocated by malloc.

 

Returns: Nothing.

 

Notes:

One argument is pushed into Stack = pointer to deallocated area.

free deallocates the number of bytes that were allocated in the call to malloc.

 

 

Example:

 

 

.text

main: .word 0

 

      pushl $0x100

      calls $1, .malloc

      pushl r0

      pushal format

      calls $2, .printf

 

      pushl $0x100

      calls $1, .malloc

      pushl r0

      pushal format

      calls $2, .printf

 

      pushl $0x100

      calls $1, .malloc

      pushl r0

      pushal format

      calls $2, .printf

 

      pushl $0x1119

      calls $1, .free

 

      pushl $0x100

      calls $1, .malloc

      pushl r0

      pushal format

      calls $2, .printf

 

      pushl $0

      calls $1, .exit

 

.org 0x1000

.data

format: .asciz "Address: 0x%08X\n"