Urgent: How to find out the size in bytes of java object
Hi Experts,
We've a requirement that we need to find out the size of a java object at run time, is there a direct java API to get the size of a composite object in memory?
Here is my requirement: We are adding string objects (which is an xml string of considerable size) into a List. After reaching certain size limit (lets say 5MB) of the list i need to put this data into DB as a CLOB. So every time I add a string object to the list, I need to see if the total size of the list exceeds the limit and if yes, flush the results into DB.
I am not sure if java has a direct API for this, if not what is the beast way to do it, it s critical requirement for us.
It would be really great if someone could help us out.
Thank you,
-Shibu.