. , . , , data1, - , "" , / .
, System.gc(). , 2 . System.gc() - , .
Java . , , . , gc , , , . - , , , - ++ - , . , , , , - , , , .
Update: Confusion. As a couple of other commentators reminded me, the garbage collection cycle obviously starts before jvm throws an OutOfMemory error. However, the behavior is still not deterministic: as this link explains, jvm does not guarantee that all dead objects will be detected in the same garbage collection loop.
source
share