out-of-memory

Large memory chunk not garbage collected

大城市里の小女人 提交于 2019-12-03 05:13:20
In a hunt for a memory-leak in my app I chased down a behaviour I can't understand. I allocate a large memory block, but it doesn't get garbage-collected resulting in a OOM, unless I explicit null the reference in onDestroy. In this example I have two almost identical activities that switch between each others. Both have a single button. On pressing the button MainActivity starts OOMActivity and OOMActivity returns by calling finish(). After pressing the buttons a few times, Android throws a OOMException. If i add the the onDestroy to OOMActivity and explicit null the reference to the memory

How to solve java.lang.OutOfMemoryError: GC overhead limit exceeded error in android studio

别说谁变了你拦得住时间么 提交于 2019-12-03 04:48:14
问题 I am using android studio 1.0 RC for 64 bit linux. When I run my application I am getting "java.lang.OutOfMemoryError: GC overhead limit exceeded" When I searched on how to solve this error I got solutions like add: -XX:-UseGCOverheadLimit to studio.vmoptions or studio64.vmoptions -Xmx2000m to studio.vmoptions or studio64.vmoptions etc. These did not work for me. Please help. Thanks in advance 回答1: I solved this issue by adding dexOptions { incremental true javaMaxHeapSize "4g" } to the

Release bitmaps from android.view.GLES20DisplayList

孤人 提交于 2019-12-03 04:38:41
问题 Is anyone knows how to Release bitmaps from android.view.GLES20DisplayList. And why it keeps them alive even if you clean, let's say, ImageView manually? Or maybe there is a way to disable GLES20DisplayList, tried to use android:hardwareAccelerated="false" in AndroidManifest, still no luck. Looks like affected only in 4.2(1) update: looks like you can't disable hardware acceleration on 4.2.1 (bug?) simple test: Android manifest: application ... android:hardwareAccelerated="false" System.out

How to deal with big strings and limited memory

喜夏-厌秋 提交于 2019-12-03 03:30:05
I have a file from which I read data. All the text from this file is stored in a String variable (a very big variable). Then in another part of my app I want to walk through this string and extract useful information, step-by-step (parsing the string). In the meanwhile my memory gets full and an OutOfMemory exception keeps me from further processing. I think it would be better to process the data directly while reading the inputstream from the file. But for organizational aims, I would like to pass the String to another part in my application. What should I do to keep the memory from

How to reproduce Java OutOfMemoryError - GC overhead limit exceeded

。_饼干妹妹 提交于 2019-12-03 02:56:39
My approach was to create hundred thousand local collections and populate them with random strings, something like this: SecureRandom random = new SecureRandom(); for(int i = 0 ; i < 100000 ; i++){ HashMap<String, String> map = new HashMap<String, String>(); for(int j = 0 ; j < 30 ; j++){ map.put(new BigInteger(130, random).toString(32), new BigInteger(130, random).toString(32)); } } I have provided -XX:+UseGCOverheadLimit jvm parameter too, but can not get the error. Is there any easy and reliable way/hack to get this error? Since you haven't accepted any answer, I'll assume that none of them

MemoryFailPoint always throws an InsufficientMemoryException even when memory is available

戏子无情 提交于 2019-12-03 02:51:19
I have written the following code to check for sufficient memory, while (true) { try { // Check for available memory. memFailPoint = new MemoryFailPoint(250); break; } catch (InsufficientMemoryException ex) { if (memFailPoint != null) { memFailPoint.Dispose(); } Thread.Sleep(waitSecond * 1000); } } I am running the above in a console application on a Windows 7 64-bit machine. There are 4 calls every 10 seconds to this method. Initially it works fine, but after 2-3 hours, there is always an InsufficientMemoryException thrown. I checked available memory and it shows more than 1 GB. I tried a lot

Can the C++ `new` operator ever throw an exception in real life?

浪子不回头ぞ 提交于 2019-12-03 01:52:06
问题 Can the new operator throw an exception in real life? And if so, do I have any options for handling such an exception apart from killing my application? Update: Do any real-world, new -heavy applications check for failure and recover when there is no memory? See also: How often do you check for an exception in a C++ new instruction? Is it useful to test the return of “new” in C++? Will new return NULL in any case? 回答1: The new operator, and new[] operator should throw std::bad_alloc , but

google maps api v2 out of memory error

心不动则不痛 提交于 2019-12-03 01:45:39
i have a huge memory problem in my app. i am using google map api v2 with ClusterManager and custom markers. i supply an image via call to markerOptions.icon(BitmapDescriptorFactory.fromBitmap(bitmap)); for each marker based on its category. the problem is: after several screen rotations my app crashes because of OOM error: 05-14 11:04:12.692 14020-30201/rokask.rideabike E/art﹕ Throwing OutOfMemoryError "Failed to allocate a 4194316 byte allocation with 1627608 free bytes and 1589KB until OOM" 05-14 11:04:12.722 14020-30201/rokask.rideabike E/AndroidRuntime﹕ FATAL EXCEPTION: GLThread 19179

OutOfMemory when loading large Background Image

我与影子孤独终老i 提交于 2019-12-03 01:28:12
I am using android:background to give a background image to android layout. After putting some images I get this exception : 08-24 00:40:19.237: E/dalvikvm-heap(8533): Out of memory on a 36000016-byte allocation. how can I use large images as backgrounds on android? can I expand the application heap memory? or is it something not good to do ? Philipp Jahoda Please have a look at my related question: High resolution Image - OutOfMemoryError Try to minimize the memory usage of your application by keeping the background image as small as possible. This can be done via: cropping the image so that

From what Linux kernel/libc version is Java Runtime.exec() safe with regards to memory?

旧时模样 提交于 2019-12-02 22:12:42
At work one of our target platforms is a resource constrained mini-server running Linux (kernel 2.6.13, custom distribution based on an old Fedora Core). The application is written in Java (Sun JDK 1.6_04). The Linux OOM killer is configured to kill processes when memory usage exceeds 160MB. Even during high load our application never go over 120MB and together with some other native processes that are active we stay well within the OOM limit. However, it turns out that the Java Runtime.getRuntime().exec() method, the canonical way to execute external processes from Java, has a particularly