Re: [go-nuts] I think I found a bug?

2021-05-26 Thread Jamil Djadala
minimally changed code that works: https://play.golang.org/p/Tcfw_EC8jMp On Thursday, May 27, 2021 at 4:11:40 AM UTC+3 johnfor...@gmail.com wrote: > Here’s the code. It might be > possible to come up with a shorter reproducer, but I’m not sure where to

Re: [go-nuts] I think I found a bug?

2021-05-26 Thread John Olson
Here’s the code. It might be possible to come up with a shorter reproducer, but I’m not sure where to start. The recursion takes place in line 21. The code works for 7 or smaller, and fails for 8 and larger. J > On May 26, 2021, at 20:34, Martin Schnabel

Re: [go-nuts] I think I found a bug?

2021-05-26 Thread Robert Engels
A slice is not an array. Words to live by. > On May 26, 2021, at 7:37 PM, Kurtis Rader wrote: > >  > It's more likely you've misunderstood how slices work. From > https://golang.org/ref/spec#Slice_types: > > > A slice is a descriptor for a contiguous segment of an underlying array and > > p

Re: [go-nuts] I think I found a bug?

2021-05-26 Thread Kurtis Rader
It's more likely you've misunderstood how slices work. From https://golang.org/ref/spec#Slice_types: > A slice is a descriptor for a contiguous segment of an *underlying array* and provides access to a numbered sequence of elements from that array. If you still believe you've found a bug we'll ne

Re: [go-nuts] I think I found a bug?

2021-05-26 Thread Martin Schnabel
Could you send a https://play.golang.org/ link showing a short example? Without much information it sounds like a you update the same slice at two different indices. It would be interesting to know how you populate the temp slice. On 27.05.21 01:52, John Olson wrote: I have a recursive functi

[go-nuts] I think I found a bug?

2021-05-26 Thread John Olson
I have a recursive function that seems to be reusing memory it shouldn't. I'm developing in Goland 2021.1.1 with go version 1.16.2. I've written a function to generate the partitions of an integer. The partitions of n are all the sets of integers that add up to n, so the partitions of 3 are {3}

Re: [go-nuts] memstats.HeapInUse is different from total in pprof

2021-05-26 Thread Ian Lance Taylor
On Wed, May 26, 2021 at 2:31 AM varun...@gmail.com wrote: > > Thanks @Ian for the clarification. > > The BySize arrays gives the number of active objects in a size class but it > does not give the total memory allocated for a size class. E.g, for 1k size > class, if 100K was the total size alloc

Re: [go-nuts] time.ParseInLocation fails silently

2021-05-26 Thread Ian Lance Taylor
On Wed, May 26, 2021 at 9:09 AM NieomylnieJa wrote: > > https://play.golang.org/p/LSIObUBjLLn > > What I expected was an error since UTC offset doesn't match that of > 'Europe/Warsaw' (+01:00), but instead the method returns no error and time > which 'loc` is nil. Not to mention I was expecting

[go-nuts] time.ParseInLocation fails silently

2021-05-26 Thread NieomylnieJa
Hey :) https://play.golang.org/p/LSIObUBjLLn What I expected was an error since UTC offset doesn't match that of 'Europe/Warsaw' (+01:00), but instead the method returns no error and time which 'loc` is nil. Not to mention I was expecting this method to act like 'time.Parse' + 'time.In' chaine

Re: [go-nuts] memstats.HeapInUse is different from total in pprof

2021-05-26 Thread varun...@gmail.com
(Sorry for the typo. Where ever I mentioned alloc -> heap, I mean all -> heap) On Wednesday, May 26, 2021 at 3:01:21 PM UTC+5:30 varun...@gmail.com wrote: > Thanks @Ian for the clarification. > > The BySize arrays gives the number of active objects in a size class but > it does not give the to

Re: [go-nuts] memstats.HeapInUse is different from total in pprof

2021-05-26 Thread varun...@gmail.com
Thanks @Ian for the clarification. The BySize arrays gives the number of active objects in a size class but it does not give the total memory allocated for a size class. E.g, for 1k size class, if 100K was the total size allocated and there are only 10 objects in it, it does not tell the memor