Not sure if it's intended behavior, but you are using defer conn.Close()
inside of an infinite for loop which means the conn never closes.
On Thursday, October 13, 2016 at 4:28:57 PM UTC-5, Morgan Hein wrote:
> Hey Rob, I really appreciate you looking and responding to this.
> After your response it gave me a hunch,and after doing some more research
> realized that you cannot deep copy the device struct like I thought I
> could, and in fact the references are still being held to the original
> decoded object, which is why it stays in memory. I think.
> I will update this post when I learn more/figure it out, but until then if
> anyone has more thoughts i'm all ears.
> On Thursday, October 13, 2016 at 1:27:39 PM UTC-7, Roberto Zanotto wrote:
>> Forgot to add... from the profile, gob is calling decodeStruct, which
>> calls decodeMap, which allocates. So we are looking for structs that
>> contain a map that are decoded and never garbage collected (maybe the
>> WatheverDevices contain a map and some other goroutine reads the Devices
>> form "input" channel and retains them?).
>> On Thursday, October 13, 2016 at 10:15:36 PM UTC+2, Roberto Zanotto wrote:
>>> I took a quick look at the code. There's the Receive loop, you allocate
>>> and decode ReceivedGobs there. As part of the ReceivedGob, a WatheverDevice
>>> is also allocated and decoded. Assuming there are no errors in decoding,
>>> you do SendResult(Device), which sends the Device to the "input" channel. I
>>> seem to understand that you expect the ReceivedGobs to be garbage collected
>>> and it seems to me that it should indeed happen. Maybe are the Devices that
>>> are filling your memory? Where do the Devices go, after they are sent to
>>> On Thursday, October 13, 2016 at 7:22:49 PM UTC+2, Morgan Hein wrote:
>>>> I'm struggling here, and hopefully someone can point me in the right
>>>> Here's a playground with the code
>>>> <https://play.golang.org/p/OQZBSnxXmI> in question. Here's the pprof
>>>> with memory usage
>>>> I cannot understand why the memory usage is going up so much. As far as
>>>> I can tell, not only am I copying the data structure that is received in
>>>> the Gob, but i'm setting the original value of the ReceivedGob to nil.
>>>> then, does the reflect.mapassign and gob.Decoder continue to increase in
>>>> I am either missing something about scope, pointers, or Gob. Any
>>>> insights or help would be greatly appreciated.
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.