Actually the scenario is that the application is deployed in JBoss.JBoss will be up and running.Now I want to check the nenory usage details within two hour time interval.Now in linux what I do to take the memory usage is view the content of /proc/meminfo.Once before running the application once after running the application.Now since there are no other application will be running it almost give me a rough estimate of the memory usage of the application.In my local machine I also use VisualVM to do the same.But what I want this process to be automated and run within two hour interval both in Window and Linux environment.
You can look at -Xloggc option. It will log garbage collection information to seperate file & does not have much overhead. You can use tools like gc viewer to view the file.