Memory handling

Gliimly 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 Gliimly statements is tracked and freed at the end of the request. You can also use a memory-optimizer (see "--optimize-memory" in gg) which frees memory as soon as possible, however keep in mind that it comes with a performance penalty and is not recommended unless you have very little available memory.

With Gliimly 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-index, new-array, new-list 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.

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

String results of any Gliimly statements will always create new memory, unless stated otherwise.
Open file descriptors
Any files opened by open-file statement are automatically closed by Gliimly 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 - Gliimly prevents this by closing any such open files when the request ends.
See also
Memory
memory-handling  
See all
documentation


Copyright (c) 2019-2024 Gliim LLC. All contents on this web site is "AS IS" without warranties or guarantees of any kind.