I think the OP was implying that GC is inefficient and was inquiring about 
certain patterns of memory use could be freed more efficiently. 

I think certain GC systems allow a region to be used to allocate objects then 
the region can be freed at once. 

Similar to the ongoing Java effort of a noop GC designed for ‘cloud functions’ 
where the entire process is effectively terminated between usages avoiding the 
need for GC (or terminated when max heap is reached and a new process started). 

> On Apr 16, 2019, at 11:31 PM, Ian Lance Taylor <i...@golang.org> wrote:
> 
>> 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.

-- 
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