[go-nuts] Re: Increasing memory usage from Gob, references never lost

2016-11-07 Thread Morgan Hein
Thanks, found this and fixed it. On Thursday, October 13, 2016 at 5:06:46 PM UTC-7, hiatt@gmail.com wrote: > > 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:2

[go-nuts] Re: Increasing memory usage from Gob, references never lost

2016-11-07 Thread Morgan Hein
Hey Robert, Late reply for anyone finding this via google later, but the issue you mentioned was the exact problem I was having. I just copied out the fields I wanted to keep and lost the reference to the original device, and this solved the memory increasing issue. On Thursday, October 13, 20

[go-nuts] Re: Increasing memory usage from Gob, references never lost

2016-10-13 Thread hiatt . dustin
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 resp

[go-nuts] Re: Increasing memory usage from Gob, references never lost

2016-10-13 Thread Roberto Zanotto
Yes, when you copy the device it's not a deep (recursive) copy, so some fields of the device could still point to things allocated by gob. Why do you care? I mean: supposing you want to keep the devices in memory, why doing a copy and not keeping the original ones? On Thursday, October 13, 2016

[go-nuts] Re: Increasing memory usage from Gob, references never lost

2016-10-13 Thread Morgan Hein
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,

[go-nuts] Re: Increasing memory usage from Gob, references never lost

2016-10-13 Thread Roberto Zanotto
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"

[go-nuts] Re: Increasing memory usage from Gob, references never lost

2016-10-13 Thread Roberto Zanotto
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

[go-nuts] Re: Increasing memory usage from Gob, references never lost

2016-10-13 Thread Morgan Hein
The title might be a little misleading, it should probably say "released" instead of "lost". On Thursday, October 13, 2016 at 10:22:49 AM UTC-7, Morgan Hein wrote: > > Howdy, > > I'm struggling here, and hopefully someone can point me in the right > direction. > > > Here's a playground with the