Blog‎ > ‎

boolean[]

posted Dec 13, 2011, 8:58 PM by Joe Pritzel   [ updated Dec 13, 2011, 8:59 PM ]
I was examining some code that used three boolean arrays instead of a byte array for the sole purpose of memory conservation (this was apparently an improvement to some previous method, but was still using an excessive amount of memory).  Some flags went off, so I decided to do a bit of reading, and it turns out that a single boolean array uses at least as much memory as a byte array.  That isn't much of a surprise, but come to find out it can use as much as an int array!

Anyway, I ended up turning those three boolean arrays into a single byte array, and it managed to drop the memory usage considerably.

Sources - 
Comments