I think I use JAMon in a uncommon way. In some cases I want to avoid stopping monitors.
For example I do not want to stop a monitor when an exception is thrown, because I want to measure only full-path scenatio of my method.
So my question is: Would starting and not stopping a monitor cause memory leaks?
This will be true, if you store references to started (and notstopped) monitors internally, for example in MonitorFactory.
Our system is supposed to work 24/7 for years without stopping, so it will be stupid, if we get memory leaks by unstopped monitors.
Warm regards,
George
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"So my question is: Would starting and not stopping a monitor cause memory leaks? "
No there wouldn't be a memory leak.
There is only one copy of each monitor with a given label (say "open()") in the MonitorFactory. However, what would happen if you start, but don't stop is that the 'active' counter would always go up (i.e. stop decrements it). That isn't a memory leak however. That can be useful to track resource leaks or concurrency, but in your case you might not want that.
However, you can call 'monitor.skip()' to decrement this counter. So when an exception is thrown in the catch block you could put skip() and when an exception is not thrown call 'stop()'.
Thanks,
Steve
Last edit: Steve Souza 2016-03-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Steve,
I think I use JAMon in a uncommon way. In some cases I want to avoid stopping monitors.
For example I do not want to stop a monitor when an exception is thrown, because I want to measure only full-path scenatio of my method.
So my question is: Would starting and not stopping a monitor cause memory leaks?
This will be true, if you store references to started (and notstopped) monitors internally, for example in MonitorFactory.
Our system is supposed to work 24/7 for years without stopping, so it will be stupid, if we get memory leaks by unstopped monitors.
Warm regards,
George
"So my question is: Would starting and not stopping a monitor cause memory leaks? "
No there wouldn't be a memory leak.
There is only one copy of each monitor with a given label (say "open()") in the MonitorFactory. However, what would happen if you start, but don't stop is that the 'active' counter would always go up (i.e. stop decrements it). That isn't a memory leak however. That can be useful to track resource leaks or concurrency, but in your case you might not want that.
However, you can call 'monitor.skip()' to decrement this counter. So when an exception is thrown in the catch block you could put skip() and when an exception is not thrown call 'stop()'.
Thanks,
Steve
Last edit: Steve Souza 2016-03-23
Great answer,
Thanks,
George
Thanks. I am glad to help. Have a great day and good luck!!
Steve