Problems with @OnLowMemory

  2 posts   Feedicon  
Replies: 1 - Last Post: August 04, 2011 07:48
by: Jaroslav Bachorik
showing 1 - 2 of 2
 
Posted: August 03, 2011 23:52 by markjwebb
I can't seem to get @OnLowMemory to work at all.
		@OnLowMemory(       
		pool = "Eden Space",     
		threshold=1000       
		) 
		public static void onLowMem(MemoryUsage mu) {      
			println(mu);  
		} 

I've tried various different strings for pool including "Eden Space" and "PS Eden Space" and various different thresholds but the method is never called.

Another problem seems to be that threshold is an int, so you can't set a threshold larger than 2^31 -1 which is quite restrictive on a 64-bit machine. Could this be changed to a long?

Thanks,

Mark
 
Posted: August 04, 2011 07:48 by Jaroslav Bachorik
The whole functionality of @OnLowMemory depends on the builtin memory related MX beans. BTrace just adds its own notification listeners to route the notifications to the declared handler methods.

The pool name depends on the garbage collector used - I would recommend using jconsole or visualvm to inspect the list of supported pools (you should look in the MX bean registered under java.lang.MemoryPool).

The threshold value should be long, it is even declared as long in the annotation signature. Are you sure you can not enter a long number there?

-JB-
Replies: 1 - Last Post: August 04, 2011 07:48
by: Jaroslav Bachorik
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close