I need to know how many objects of some type exist in my system any time. Standard method with static variable and and increment/decrement in constructor/distructor doesn’t work because missed Object.finalize method.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As a brutforce answer you can produce all your objects with special singleton factory, where you can increment count, when new object is produced, and delete them through this factory to:
This approach do not give you exactly results, but something roundly.