| %LSEEK (D3/Unix) | Index Level | %MEMCCPY |
| Syntax | variable = (char*)%MALLOC( size ) |
| Category | BASIC |
| Type | C Function |
| Description |
allocates a memory block of "size" bytes and returns the address of this block.
The memory is freed by the "%free()" built-in. If the system fails to allocate memory, a NULL pointer is returned. If the FlashBASIC program terminates, the malloc'ed space is not released automatically. This feature can be used to create 'static' data, live across program executions. The TCL command 'environ' uses this fact. "malloc'ed" memory may be "free'd" by "exit"ing the Pick process. |
| Options | |
| See Also | CFUNCTION %READ (D3/Unix) %FREE environ %PUTENV disc |
| Example |
ptr=(char*)%malloc( 2048 )
if ptr=0 then stop 'cannot allocate memory' |
| Warnings | |
| Compatibility | D3/Unix |
| %LSEEK (D3/Unix) | Index Level | %MEMCCPY |