I have created a client/server pair with two threads to send and receive objects, While it runs fine at the beginning I'm experiencing an OutofMemory error when it runs for a while, I was looking out how te garbage collector works in Android 2.3.4 and it seems that some objects are kept by the ObjectInputStream and ObjectOutputStream from being collected by the GC. I used the Memory Analysis Tool in Eclipse to find out where the memory leak is located and found that there is a IdentityHashMap object that keeps the reference to te data being sent and received. I will like to find out a way around this issue on how to release this data or how to remove the reference this object keeps on my data preventing it from being collected. The memory heap I'm working with is pretty big for a cell phone 64M, and if I try the same with big chunks of data it works fine, as long as I don't run it for very long.
问问题
84 次