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 
>>> "input"?
>>>
>>> On Thursday, October 13, 2016 at 7:22:49 PM UTC+2, Morgan Hein wrote:
>>>>
>>>> Howdy,
>>>>
>>>> I'm struggling here, and hopefully someone can point me in the right 
>>>> direction.
>>>>
>>>>
>>>> Here's a playground with the code 
>>>> <https://play.golang.org/p/OQZBSnxXmI> in question. Here's the pprof 
>>>> with memory usage 
>>>> <https://dl.dropboxusercontent.com/u/11780/memgraph-huge.pdf?dl=1> 
>>>> <https://docs.google.com/viewer?url=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F11780%2Fmemgraph-huge.pdf%3Fdl%3D1&embedded=true&chrome=false&dov=1>
>>>>  
>>>> <https://docs.google.com/viewer?url=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F11780%2Fmemgraph-huge.pdf%3Fdl%3D1&embedded=true&chrome=false&dov=1>
>>>> .
>>>>
>>>>
>>>> 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. 
>>>> Why, 
>>>> then, does the reflect.mapassign and gob.Decoder continue to increase in 
>>>> memory?
>>>>
>>>> I am either missing something about scope, pointers, or Gob. Any 
>>>> insights or help would be greatly appreciated.
>>>>
>>>> Thanks!
>>>>
>>>

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

Reply via email to