On Tuesday, December 12, 2017 at 9:50:57 AM UTC-5, Jan Mercl wrote:
>
> On Tue, Dec 12, 2017 at 3:39 PM T L >
> wrote:
>
> > Does it still valid for the latest gc?
> > In other words, does gc 1.9 still check the segment [len(s), cap[s]) of
> a slice s to find active pointers?
>
> It's not an op
On Tue, Dec 12, 2017 at 3:39 PM T L wrote:
> Does it still valid for the latest gc?
> In other words, does gc 1.9 still check the segment [len(s), cap[s]) of a
slice s to find active pointers?
It's not an option, the garbage collector must always scan the whole
backing array.
--
-j
--
You
https://github.com/golang/go/wiki/SliceTricks
*NOTE* If the type of the element is a *pointer* or a struct with pointer
fields, which need to be garbage collected, the above implementations of Cut
and Delete have a potential *memory leak* problem: some elements with
values are still referenced