On Tue, Apr 16, 2019 at 8:46 PM <jlforr...@berkeley.edu> wrote:
>
> Go's garbage collector is very nice, and solves many problems that come up in 
> C programs.
>
> However, one thing I've been wondering about is explicitly freeing memory. I 
> know it can't be done
> now, and that the GC takes care of everything.
>
> But I was thinking about multi-pass programs like compilers, that do a bunch 
> of work in one pass.
> Once the pass is complete then most of the memory used by the pass could be 
> freed. But that
> will never happen because the memory appears to the GC as still in use. There 
> are probably
> other examples of such program structure.
>
> What's the current thinking on this problem?

I'm not clear on what the problem is.  If the memory is still
referenced, then it can't be freed.  If the memory can be freed, then
there shouldn't be any references to it.  So, at the point where you
would explicitly free memory, just clear the pointers that point to
it.  Then the GC will free the memory.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to