erdemolkun / plist

Automatically exported from code.google.com/p/plist

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BinaryPropertyListParser incorrectly checking for OOM conditions

GoogleCodeExporter opened this issue · comments

BinaryPropertlyListParser checks to see if it'll use too much memory by 
checking Runtime.getRuntime().freeMemory() (here: 
https://code.google.com/p/plist/source/browse/trunk/src/main/java/com/dd/plist/B
inaryPropertyListParser.java#178)

But as you can see from http://stackoverflow.com/a/18375641, we should really 
be checking (.maxMemory() - .totalMemory()) + .freeMemory()

Personally, I would remove this error checking and just let the Java runtime 
fail as the error should be obvious enough and trying to determine if there is 
enough memory is wrought with problems as it is. (Since gc'ing could change 
that amount.)

Original issue reported on code.google.com by mars.mar...@gmail.com on 17 Oct 2014 at 12:12

Memory checks have been removed

Original comment by daniel.dreibrodt on 27 Feb 2015 at 5:58

  • Changed state: Fixed