Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Gaming > Development Programming Misc > Counting Class ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 967 of 979
Post > Topic >>

Counting Class Instantiations

by Luc The Perverse <ataylor_no_spa_am@[EMAIL PROTECTED] > Jan 12, 2008 at 03:50 PM

I am trying to improve performance in a game I have written.

I was wondering if Java has a built in feature that could be easily 
enabled to count unique class instantiations.

I am concerned in my functions which execute 100 times a second (well at 
least they are supposed to) that I am needlessly recreating objects over 
and over and over again.  Perhaps for simple data this is not a large 
consideration (a single string 1 time) - but for instance, I was doing 
something like creating a unique "Rect" (Rectangle class) for every 
sprite in the entire board, every frame iteration to check for 
collisions.  Since there are between hundreds and thousands of blocks 
which make a board - I was needlessly creating millions of objects per 
second - which then had to be garbage collected.

I am not asking for game engine specific optimization techniques - that 
would no doubt be a question best suited for the GTGE forums.

I just want to see a count of instances classes which were instantiated 
or garbage collected - and if anything ever hits 100 million then 
perhaps I can raise a flag to check for it.

Even better would be instantiation count from unique position in the 
call stack - so it wouldn't be such a needle in a haystack.

Does such a mechanism exist?

Thank you

--
Luc The Perverse




 2 Posts in Topic:
Counting Class Instantiations
Luc The Perverse <atay  2008-01-12 15:50:40 
Re: Counting Class Instantiations
Miss Elaine Eos <Misc@  2008-01-13 01:48:14 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue May 13 13:51:03 CDT 2008.