• 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

garbage collection

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
i m having a problem with the garbage collection.Its regarding Vectors.....but i wont go into details of it.just let me know...if A references B and B references C ,and after i set A to null,shouldn't the object to which A was referencing be garbage collected?
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Monojit,
Assuming that there are no more references to the object, it will be eligible for gabage collection. When it gets collected though is up to the JVM and the vendor who developed the GC scheme. All you as a programmer can do is to make sure is that an object is eligible for GC ...
Regards,
Manfred.
 
monojit choudhury
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,thanks for the reply.
i m using jdk 1.2.2. and according to me theres a bug in the GC.
i'll explain my problem to u in details.I have a Vector which has array objects in it.now if i go on adding more array objects to it,as soon at it crosses the default capacity,i.e 10,it creates a new Vector and does an Array copy with the 10+1 elements in it(i've gone through the souce code of the Vector API).so the reference to the First Vector is set to null,but since the arrays in it r referefcing to some other objects,the vector doesnt get garbage collected and i m getting a memory leak in my program coz of this.
 
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic