Xamarin Studio java.lang.OutOfMemoryError
Xamarin Studio is a very buggy and flaky product. Having being used it on an every day basis, it’s getting rather frustrating to deal with Xamarins inferior QA.
Here’s one example that keeps on coming up on the “Stable” channel. (I have to bite my tongue really hard not to say what I think about their definition of “Stable”)
This is the dreaded java.lang.OutOfMemoryError:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Tool exited with code: 3. Output:
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
at java.util.BitSet.initWords(BitSet.java:164)
at java.util.BitSet.<init>(BitSet.java:159)
at com.android.dx.ssa.SsaMethod.bitSetFromLabelList(SsaMethod.java:137)
at com.android.dx.ssa.SsaBasicBlock.newFromRop(SsaBasicBlock.java:161)
at com.android.dx.ssa.SsaMethod.convertRopToSsaBlocks(SsaMethod.java:173)
at com.android.dx.ssa.SsaMethod.newFromRopMethod(SsaMethod.java:103)
at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:44)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:98)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:72)
at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:299)
at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:139)
at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:94)
at com.android.dx.command.dexer.Main.processClass(Main.java:682)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
at com.android.dx.command.dexer.Main.access$600(Main.java:78)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
Despite having reported this as a bug, it hasn’t been addressed at all. I am still seeing this on Xamarin Studio for OS X v5.4 (build 420).
Here’s a workaround:
Edit the .csproj file and edit the JavaMaximumHeapSize element and set its value to 1G.
1
2
3
<PropertyGroup>
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
</PropertyGroup>
This post is licensed under CC BY 4.0 by the author.