GOLF(2gg)

NAME
memory-handling - Golf documentation (memory)

DESCRIPTION
Golf is a memory-safe language.

Your application cannot access memory outside of valid statement results. Trying to do so will result in your program erroring out.

Memory allocated by Golf statements is tracked and freed at the end of the request.

With Golf there is no need to free memory manually. Memory is automatically freed even if it is no longer accessible to the program, thus preventing memory leaks; this is important for stability of long-running processes.

Some statements (new-tree, new-hash, new-list, new-array and set-string) have the option of allocating memory that won't get freed at the end of the request and is available to any request served by the same process. This kind of memory is called "process-scoped". A process-scoped string can be manually freed.

Golf handles memory references and assignments automatically, preventing dangling memory.

String results of any Golf statements will always create new memory, unless stated otherwise.

OPEN FILE DESCRIPTORS

Any files opened by open-file statement are automatically closed by Golf at the end of the request. This enhances stability of long-running server processes because Linux system by default offers only about 1000 open files to a process. A bug can quickly exhaust this pool and cause a malfunction or a crash - Golf prevents this by closing any such open files when the request ends.

SEE ALSO
 Memory

memory-handling See all documentation