Re: [go-nuts] Q about memory allocation/cleanup with interfaces

2020-09-13 Thread Jesper Louis Andersen
On Sun, Sep 13, 2020 at 1:42 PM Jesper Louis Andersen < jesper.louis.ander...@gmail.com> wrote: > Second, garbage collection must run. It runs periodically, but it can take > some time before it does so, and if you check memory usage right after > you've freed up data, it might not have run yet.

Re: [go-nuts] Q about memory allocation/cleanup with interfaces

2020-09-13 Thread Jesper Louis Andersen
It is perhaps easiest if I go through the conditions which must be met for data to be reclaimed by the Operating System: First, the data must be unreachable by goroutines through a path of pointers. When you nil the object, you break such a path, but you must make sure there are no other such