Friday, February 12, 2010

Java memory leak

I had a interesting problem regarding JAVA memory leak couple of days back. Typically, java garbage collector collects all the un-referred memory space. My problem was interesting, I had a fixed array of objects and some of them (in random) hold the information about few other objects in the array. The array was like a queue and object are coming from one direction and going out from another direction. When each object left the array, the object is theoretically dead to me. I don't keep any other reference to it. Interestingly, it was causing an chain of references where the last object sitting on my array and the first object died long ago. The problem was interesting.

I am having memory problem again and this time I did some google on JAVA memory leak problem. I found that I am not the only one having similar kind of problem, there are thousands having similar kind of problem with their JAVA codes. Obviously I would not say this is the problem of the java platform, this is just a bad practice. The interesting thing I conclude is a bad programming practice can cause the harm no matter how good the platform is!

No comments:

Post a Comment

Please, no abusive word, no spam.