FAQ
This program defines a simple stack, pushing and popping elements.
   http://play.golang.org/p/NPFe_eRy2q

Does the garbage collector takes the length of a slice in account when it
looks for reachable objects ?
I mean, can GC consider the elements at indices between "length" and
"capacity" as garbage, collect them, and put a nil pointer at these indices
?

I imagine that these objects are not garbage collected, but it is not very
explicit in the specs.
And I don't see the reason why it would be forbidden...
Or it is expected that when a slice is resliced to its full length, all
objects that were "hidden" are expected to have stayed at their place...


--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 5 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 6, '14 at 3:19p
activeOct 6, '14 at 6:25p
posts5
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase