Apologies in advance if this is not the right group to post this...

I am having a memory leak issue in an app that reads data reports from a 
sensor and stores them for a length of time.  Running pprof on the app, It 
appears that the memory is not getting released when the old data is 
purged.  

There can be several report types, so I created an interface definition and 
am storing these reports under a slice of interfaces in a map with a 
timestamp key

When it comes time to purge, I'm setting the slice at that timestamp to 
nil, but the memory does not seem to be reclaimed.

Dirty Details:
The data comes in as a string message which I unmarshal into one of the 
concrete report types.  The reports are stored in the following structure...
map[string]map[int64][]ReportIface  where the first map has a key of 
sensorID and the inner map has a key of timestamp.  The ReportIface is an 
interface definition that all of the reports implement

During purging, I roll through the inner map and if the timestamp key is 
less than the purge time I  run the following
if reports[timestamp] != nil {
  reports[timestamp] = nil
}
delete(reports, timestamp).

Is there anything else I need to do for this?   Pprof is showing the memory 
from the unmarshal as still in use even after the purge.

Thanks in advance,
Chris

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d0a1eee7-7968-4560-9cd4-98d69e48ea91n%40googlegroups.com.

Reply via email to