3 ms·
Ok so garbage collection is optional, how about garbage generation? Is there any way to manually clean up resources if GOCG=off, or will memory usage continue t
by gkfasdfasdf 3y ago
Ok so garbage collection is optional, how about garbage generation? Is there any way to manually clean up resources if GOCG=off, or will memory usage continue to grow unbounded as new objects are created?
- vaastav 3y agoGrows unbounded. I wasn't recommending that one should set GOGC=off. Just making a remark that one could should they choose to do so. EDIT: Sorry, I misunderstood part of your question. The memory grows unbounded unless you call runtime.GC() which triggers garbage collection. But this is a blocking call and essentially block your whole program.
- Cthulhu_ 3y agoI think in theory you can write code (or do some tricks) to avoid all heap allocation.