I am currently using Visual VM to monitor the heap memory usage of my Java application. However I would like to somehow see the heap memory usage over a span of time like for ex
Run your Java program with the following Java options:
-Xloggc:log.out -XX:+PrintGCDetails -XX:+PrintGCTimeStamps
and download HPjmeter to visualize log.out
.
Also see SUN's GC portal webpage for more options to run with. Since the data is written to a file, you won't have any problems collecting days or weeks worth of data. Of course, if you wish to visualize data with lots of information, you'll need to run HPjmeter with more memory.
Your other option is to use JConsole.