locked
Garbage collection after DSS Operation RRS feed

  • Question

  • Hi

    I have a DSS Operation called "Poll" . The execution of the PollHandler generates  N (a variable number) of  collections of 96  of MeterReads composed by a  tuple (timestamp and a value). After the generation, these values are returned in the response message to the service that invoked the Poll operation. The generated data is NOT stored as part of the service state. This service and the service that invokes "Poll" run on different DSS Nodes.

    This is the PollHandler:
     /// <summary>
            /// Handles Poll messages
            /// </summary>
            /// <param name="poll">the Poll request</param>
            [ServiceHandler(ServiceHandlerBehavior.Exclusive)]
            public IEnumerator<ITask> PollHandler(Poll poll)
            {          
                               
                    DayReads[] meterReaderDataList = new DayReads[_state.MeterReaderIDList.Count];                
                                  
                    int idx=0;
                    foreach (System.Guid guid in _state.MeterReaderIDList)
                    {  
                        DateTime baseDateTime = new DateTime(2009, 1,poll.Body.DayOfMonth , 0, 0, 0);
                        Random random = new Random();
                        Tuple[] tuples = new Tuple[96];
    
                        for (int i = 0; i < 96; i++)
                        {
                            TimeSpan span = baseDateTime - poll.Body.BaseTime;
                            tuples[i]=new Tuple(Convert.ToUInt32(span.Ticks/Math.Pow(10,7)), Convert.ToInt16(random.Next(0,50)));
                            baseDateTime = baseDateTime + new TimeSpan(0, 0,15, 0, 0);
                        }
    
                        meterReaderDataList[idx] = new DayReads(guid, tuples);
                        idx++; ;
                    }
                    poll.ResponsePort.Post(new PollResponseType(new Uri(this.ServiceInfo.Service),meterReaderDataList));  
                     
    
                yield break;
            }

    The problem I am experiencing is the following: The Poll operation is executed several times. For some reason, the memory taken by the DSS node running the Poll operation increases after every execution of the Poll operation. Since generated data is not stored as part of the state of the service and it is returned as part of the Poll response, I would expect the size of the process to fluctuate during the operation but not to accumulate after every execution. Nevertheless, the memory taken by the tuple generation stays allocated during all the life of the DSS Node.

    I suspect that the PollResponseType object instance is not disposed when the response message is returned. What can I do to release that memory?

    Thanks!

    Wednesday, October 14, 2009 8:45 PM

Answers

  • Over what time period and how much RAM is allocated by the process? It might simply be the case that the garbage collector hasn't needed to run a gen 0 collection. Check out a tool call 'CLR Profiler' (http://www.microsoft.com/downloads/details.aspx?familyid=A362781C-3870-43BE-8926-862B40AA0CD0&displaylang=en), it should help you track down most memory and GC related issues. There's also a number of counters in the windows performance monitor you could take a look at under the '.NET CLR Memory' category.
    Thursday, October 15, 2009 12:17 AM
  • I have 10 nodes with this Poll operation. Every time Poll is executed 500 MB of data are generated and returned back to the caller service, after that execution each of the 10 dsshost processes has grown to something more than 500GB. On the next call, they grow to 1GB, but on every of the subsequent next calls the growth  rate is reduced progressively. After the 15th call each of the nodes takes a memory of 2.5GB.  Does this mean that the garbage collector only starts collecting after a while?

    I'll check the CLR profiler too.

    I am working with on 64 bit machine with 64 GB of RAM. 

    Thanks

    Friday, October 16, 2009 12:16 AM

All replies

  • Over what time period and how much RAM is allocated by the process? It might simply be the case that the garbage collector hasn't needed to run a gen 0 collection. Check out a tool call 'CLR Profiler' (http://www.microsoft.com/downloads/details.aspx?familyid=A362781C-3870-43BE-8926-862B40AA0CD0&displaylang=en), it should help you track down most memory and GC related issues. There's also a number of counters in the windows performance monitor you could take a look at under the '.NET CLR Memory' category.
    Thursday, October 15, 2009 12:17 AM
  • I have 10 nodes with this Poll operation. Every time Poll is executed 500 MB of data are generated and returned back to the caller service, after that execution each of the 10 dsshost processes has grown to something more than 500GB. On the next call, they grow to 1GB, but on every of the subsequent next calls the growth  rate is reduced progressively. After the 15th call each of the nodes takes a memory of 2.5GB.  Does this mean that the garbage collector only starts collecting after a while?

    I'll check the CLR profiler too.

    I am working with on 64 bit machine with 64 GB of RAM. 

    Thanks

    Friday, October 16, 2009 12:16 AM