• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to know how many objects are unclaimed.?

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I was wondering if there is any way to know how many objects are present and how many unclaimed by the garbage collector while a program is being run. For instance in a code of 1500 lines there may be numerous objects still alive even though not going to be used.

Which brings me to another question what effect do unclaimed objects have on the efficiency in terms of memory usage.Do unclaimed objects have any effect on the program ?

Regards
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's no way (AFAIK) in the standard API to ask the garbage collector how many objects are waiting to be cleaned up.

Ofcourse the garbage collector takes a small amount of processor time, and objects that are not cleaned up take up memory, but you should normally not be concerned with it - the garbage collector contains some very clever algorithms to keep things as efficient as possible.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic