Suggestions to avoid bitmap Out of Memory error

just use this function to decode…this is perfect solution for your error..because i also getting same error and i got this solution.. public static Bitmap decodeFile(File f,int WIDTH,int HIGHT){ try { //Decode image size BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; BitmapFactory.decodeStream(new FileInputStream(f),null,o); //The new size we want to scale to final int REQUIRED_WIDTH=WIDTH; … Read more

Java – shutting down on Out of Memory Error

In Java version 8u92 the VM arguments -XX:+ExitOnOutOfMemoryError -XX:+CrashOnOutOfMemoryError were added, see the release notes. ExitOnOutOfMemoryError When you enable this option, the JVM exits on the first occurrence of an out-of-memory error. It can be used if you prefer restarting an instance of the JVM rather than handling out of memory errors. CrashOnOutOfMemoryError If this … Read more

Composer Update failed — out of memory

Check the Composer’s troubleshooting wiki, especially the memory limit errors section. For instance, by running the composer like this: php -d memory_limit=-1 `which composer` update I get no error anymore. So it is probably an insufficient memory issue that can be solved inline, without altering your default PHP configuration. What the command above does is … Read more

Exception : OutOfMemoryError

Try to create scaled bitmap using following line of the code: Bitmap scaledBitmap = Bitmap.createScaledBitmap(myBitmap, width, height, true); Check the following links: android – out of memory exception when creating bitmap Android out of memory exception with bitmaps Can I catch out of memory exception in Android in Bitmap allocation for decoding a picture file?

Out of memory while creating bitmaps on device

use this method to resize your bitmap- Bitmap bm=decodeSampledBitmapFromPath(src, reqWidth, reqHeight); use this Defination- public Bitmap decodeSampledBitmapFromPath(String path, int reqWidth, int reqHeight) { final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(path, options); options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); // Decode bitmap with inSampleSize set options.inJustDecodeBounds = false; Bitmap bmp = BitmapFactory.decodeFile(path, options); return bmp; … Read more

Error While Reading Large Excel Files (xlsx) Via Apache POI

Here is an example to read a large xls file using sax parser. public void parseExcel(File file) throws IOException { OPCPackage container; try { container = OPCPackage.open(file.getAbsolutePath()); ReadOnlySharedStringsTable strings = new ReadOnlySharedStringsTable(container); XSSFReader xssfReader = new XSSFReader(container); StylesTable styles = xssfReader.getStylesTable(); XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator) xssfReader.getSheetsData(); while (iter.hasNext()) { InputStream stream = iter.next(); processSheet(styles, strings, … Read more