I have a question that Can we use Object pooling concept instead of declaring large size byte array as 20MB. If yes then How? Actually I have a statement as byte[] fileData = new byte[2097152];
because I have to read that much data from a video file which returns OutOfMemory Exception frequently in the app after we are trying to hit the same java file 20 to 24 times continuously. Means this is not the error, in this case heap memory gets full and GC is unable to clear the same in the given time span that's why it returns OutOfMemory Exception. So, Can we use here ObjectPooling concept of JAVA for higher memory utilization.
Thanks in advance.