Hi There,

I set up my app to run over night and see what happened to its RAM and noticed something strange when I came in this morning.

All night there was 0 active sessions ( expected ) but the RAM would fluctuate between 47 MEG and 50 MEG over a period of a couple of minutes. I then went to the page, thus creating a new session and the RAM used dropped by 6 MEG. Another couple of sessions and it dropped a bit further, with finally after 7 session it was down by 10 MEG.

So before i go any further with my testing and questions for you guys I thought I should get my code double checked in regards to how Im reading this RAM


So heres a grab of the output this moring just before and after I made my sessions

08:32:16,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Total Mem : 63.0 MG 08:32:16,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Free Mem : 14.0 MG 08:32:16,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Used : 49.0 MG 08:32:16,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Active Sessions : 0 08:32:31,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Total Mem : 63.0 MG 08:32:31,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Free Mem : 14.0 MG 08:32:31,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Used : 49.0 MG 08:32:31,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Active Sessions : 0 08:32:42,901 OFF [WorkerThread3] (Log.NSLogOut:1546 appendln) - Session Created : 9KSkQ9FaSsLnfpoyzVpWug 08:32:46,256 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Total Mem : 63.0 MG 08:32:46,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Free Mem : 20.0 MG 08:32:46,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Used : 43.0 MG 08:32:46,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Active Sessions : 1 08:33:00,405 OFF [WorkerThread3] (Log.NSLogOut:1546 appendln) - Session Created : jxj7Lo4ui5vGB836bESL5w 08:33:01,256 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Total Mem : 63.0 MG 08:33:01,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Free Mem : 22.0 MG 08:33:01,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Used : 41.0 MG 08:33:01,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Active Sessions : 2 08:33:04,739 OFF [WorkerThread3] (Log.NSLogOut:1546 appendln) - Session Created : 1xt5mbejacNB80hFeXzaog 08:33:10,279 OFF [WorkerThread3] (Log.NSLogOut:1546 appendln) - Session Created : zOPs95bCrNNtFpKqEBpfKM 08:33:14,493 OFF [WorkerThread3] (Log.NSLogOut:1546 appendln) - Session Created : COs82ecQ3hiUZbxiwCnfOg 08:33:16,256 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Total Mem : 63.0 MG 08:33:16,256 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Free Mem : 25.0 MG 08:33:16,256 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Used : 38.0 MG 08:33:16,257 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Active Sessions : 5 08:33:16,863 OFF [WorkerThread3] (Log.NSLogOut:1546 appendln) - Session Created : ZyG7CBSnsBd8diFi3l5Vf0 08:33:29,397 OFF [WorkerThread3] (Log.NSLogOut:1546 appendln) - Session Created : 7xi2ClgCGHCbDoSSt4bUJw 08:33:31,256 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Total Mem : 63.0 MG 08:33:31,256 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Free Mem : 25.0 MG 08:33:31,256 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Used : 38.0 MG 08:33:31,256 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Active Sessions : 7 08:33:46,256 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Total Mem : 63.0 MG 08:33:46,256 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Free Mem : 25.0 MG 08:33:46,256 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Used : 38.0 MG 08:33:46,256 OFF [Timer-1] (Log.NSLogOut:1546 appendln) - Active Sessions : 7


And heres the code, it set on a timer to run every 15 seconds. Im I doing this correctly ?

public class MemoryWatch extends TimerTask
{
        public RISApplication app;
        
        public MemoryWatch(RISApplication newApp) {
                app = newApp;
        }
        
        public void run()
        {
                try
                {
                        Runtime runtime = Runtime.getRuntime();
                        long totalMem = runtime.totalMemory();
                        long freeMem = runtime.freeMemory();
double difference = new Double(((totalMem/1024)/1024) - ((freeMem/ 1024)/1024)).doubleValue();
                        
NSLog.out.appendln("Total Mem : " + new Double(((totalMem/1024)/ 1024)).doubleValue() + " MG"); NSLog.out.appendln("Free Mem : " + new Double(((freeMem/1024)/ 1024)).doubleValue() + " MG");
                        NSLog.out.appendln("Used : " + difference + " MG");
                        NSLog.out.appendln("Active Sessions : " + 
app.activeSessionsCount());
                        
                }
                catch(Exception e)
                {
                        NSLog.out.appendln("Error occured during the Memory 
Watch");
                }
        }
                
}




Owen McKerrow
WebMaster, emlab
Ph : +61 02 4221 5517
http://emlab.uow.edu.au

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 'The test of a first-rate intelligence is the ability to hold two opposed ideas in the mind at the same time and still be able to function.'
-F.Scott Fitzgerald,


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Reply via email to