I develop an android application, in c#, using xamarin. It uses a lot of memory. For long time, I used weaker 2GB device to run it successfully. Now I changed phone for 4GB device and suddenly I get out of memory exception. It's caused by creating larger bitmaps.
Here you can see output:
(13022): Starting a blocking GC Alloc
(13022): Clamp target GC heap from 271MB to 256MB
(13022): Alloc concurrent mark sweep GC freed 4(96B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 172us total 13.525ms
(13022): Forcing collection of SoftReferences for 833KB allocation
(13022): Starting a blocking GC Alloc
(13022): Clamp target GC heap from 271MB to 256MB
(13022): Alloc concurrent mark sweep GC freed 5(120B) AllocSpace objects, 0(0B) LOS objects, 0% free, 255MB/256MB, paused 175us total 13.474ms
(13022): Out of memory: Heap Size=256MB, Allocated=255MB, Capacity=256MB
I tried all possible combinations of setting Java Max Heap Size = 1G
and writing to manifest android:largeHeap="true"
as was recommended here but it is still saying I'm only on 256MB, crashing at the same point. Any ideas why I don't get more heap memory? There is a lot of free memory in the system. When the time comes, I will do some optimizations, but at the moment I want to use full capabilities of my testing device to code easy way. I looked at various articles, questions and one of two highlighted actions always solved the problem. I have no idea what condition is wrong in my code.
Edit:
here is whole manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="AlienChessAndroid.AlienChessAndroid" android:versionCode="1" android:versionName="1.0" android:largeHeap="true" android:installLocation="auto">
<uses-sdk android:minSdkVersion="23" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:label="Alien Chess" android:icon="@drawable/Alien">
</application>
</manifest>