This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Proxying Objects Causes OutOfMemoryError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Proxying Objects Causes OutOfMemoryError" Watch "Proxying Objects Causes OutOfMemoryError" New topic
Author

Proxying Objects Causes OutOfMemoryError

Jay Blanton
Greenhorn

Joined: Jun 17, 2004
Posts: 7
I have retrieving my Object instances from a class with a method called getProxy. That method adds InvocationHandlers to extract out logic like tracing logic. Inside my TracingInvocationHandler, I print a statement before a method is executed and one after. I am able to run this fine through some functionality, but other methods cause an OutOfMemoryError. Those methods may create massive size lists within them...would this cause a problem? Is the Proxy to slow in performance to use it to do this?




Thanks for your help,

-jay
Ajay A Patil
Greenhorn

Joined: Apr 13, 2006
Posts: 22
The massive size lists created by your methods must certainly
consuming memory, but the Proxy code does not seem to be related
to them.

You can try
- Commenting out the logging statements and check how it works.
- Commenting out your DateTime class.

Another suggestion is to implement a static method DateTime.getCurrentTime()
so you dont create two new DateTime instances for each method invocation.

Finally, are you caching your java.lang.reflect.Method instances ?
i.e how do you pass the Method object to the proxy class's invoke
method.

Hope this helps,
Ajay
 
Don't get me started about those stupid light bulbs.
 
subject: Proxying Objects Causes OutOfMemoryError
 
Similar Threads
synthetic classes
does gc still have a chance to do its job if i kill the java process
Regarding java Proxy object
problems using a dynamic proxy with wait(); notify()
environment variable referance in Web.xml