TechLang manages memory automatically, but also provides commands for advanced control and inspection.
Most objects are managed automatically. Unused memory is reclaimed by the garbage collector.
For resources like files or sockets, always close them when done:
let f = open("file.txt")
... // use the file
f.close()
Check current memory usage:
let mem = memory_usage()
print("Memory used:", mem, "bytes")
Request a manual garbage collection (optional):
gc_collect()
When handling large datasets, process data in chunks to reduce memory usage:
for line in readlines("largefile.txt") {
process(line)
}
See the