Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
Hello,

I built a game that played by 2 computers. I want to determin the memory space needed for playing one move??

Is there any library in java that can help me to do that??

Regards,

caabool_oo
Posted
Comments
Keith Barrow 14-May-11 8:28am    
This depends on your code. Doubtless there are preformance analysers/profilers in Java that will give you the answer. You should google for "Java Profiler". I'm not a Java dev, so I can't give a more concrete answer than this.
Gerben Jongerius 14-May-11 8:55am    
Depends a bit on the classes used, but you could try to use the totalMemory and freeMemory methods from the Runtime class.

But this should never be used in a real live situation, just a clean and nice testing environment. This due to the garbage collector and how it cleans memory.

1 solution

Try:
Java
Runtime.getRuntime().totalMemory();
 
Share this answer
 
Comments
caabool_oo 12-Jun-11 12:55pm    
Thank you very much...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900