Memory allocation. You should always check the result of the function for 0. Access to erroneously reserved memory lead to significant errors in the script execution. The allocated memory is initialized as an empty string, or, in other words, the first (and only the first) byte is set to 0.
You may use the function name new for alloc too. You may therfor never use new as an identifier of one of your script identifiers.
With alloc reserved memory the reserved memory must in every case be released with release or free.
Memory allocation to strings can also be statically set up using the following definition :
The type of reservation is the simpler solution for small strings. A script instruction may however only occupy a fix number of of bytes (128 kB as default). By calling sub-procedures you will quickly reach this limit.
|Return||char*||Reserved memory of the required size or 0
Result is initialized as empty string (which, in other words, means, that the first byte is set to 0.)
|size||int||-||Size of the memory in bytes that is to be reserved. Use this carefully, it is a limited resource.|
Create a string which can fetch a CLOB from the database
char *clob = alloc(32768);
if (!clob) return 1; : release (clob);
Alphabetic index HTML hierarchy of classes or Java