>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help User

# Memory Management

Some DLL procedures return pointers to memory or require parameters of pointers to memory that cannot be provided by referencing a J array. The following verbs, defined in main\dll.ijs, are provided to allocate, free, read and write memory:

    mema      allocate bytes of memory

    memr      read bytes from memory (as type)

    memw      write bytes to memory (from type)

    memf      free memory allocated by mema

`mema` allocates memory. The result is an integer memory address. A 0 result indicates the allocation failed. For example:

       address=: mema length

`memf` frees memory. The argument could be a `mema` result or pointer returned by a procedure. A 0 result is success and a 1 is failure.

       memf address

`memr` reads data from memory. A _1 count reads up to the first 0 (read a C string).

       data=: memr address,byte_offset,count [,type]

`memw` writes data to memory. If type is char, count can be 1 greater than the length of the string left argument, in which case a 0 is appended (writing a C string).

       data memw address,byte_offset,count [,type]

`memr` and `memw` type parameter is 2 4 8 or 16 for char integer float or complex. The default is 2. The count parameter is a count of elements of the type.

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help User