Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I've updated the description, as the crash seems to be related to the conversion:
DocumentContents = Convert.ToBase64String((byte)media.File)
and not to Json.NET as previously mentioned.
Sep 11 13:43:33 Flow-PIlotss-dev-iPad MCSCAiOS <Error>: at (wrapper managed-to-native) string.InternalAllocateStr (int) <0xffffffff>
Sep 11 13:43:33 Flow-PIlotss-dev-iPad MCSCAiOS <Error>: at System.Text.StringBuilder.InternalEnsureCapacity (int) [0x000b1] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Text/StringBuilder.cs:716
^ what size is your image ?
Can you attach it to the bug report ?
note: A base64 representation of an image can be quite large (string are unicode, 2 bytes per char, in .NET). You might want to use a stream based approach.
The images are about 4-500Kb. For the test purposes it is exactly the same image I am resending.
I know it is not the best way to do it, but unfortunately the backend is out of my control...
I really suspect your app is running out of memory. Serialization can be very memory hungry process.
> Sep 11 13:43:34 Flow-PIlotss-dev-iPad ReportCrash <Notice>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/MCSCAiOS_2014-09-11-134333_Flow-PIlotss-dev-iPad.ips using uid: 0 gid: 0, synthetic_euid: 501 egid: 0
^ the iOS crash report (once symbolicated) might be helpful. Can you attach it ?
Your (attached) stack trace does not point to `Convert.ToBase64String` so I assume that might happen before ? and the same data is (likely) converted several time (common in serialization) with multiple representation kept referenced in memory.
> but unfortunately the backend is out of my control...
I do not think it really matters to the backend as the same stuff can be sent on the wire in a stream mode (without the same memory requirement). However I can't say if JSON.NET supports that.
@Jan have you tried to use `sgen` as the garbage collector ? That might help you (within limits).
I do not know RestSharp so I can't tell you if there are "lighter" ways to process such requests. However the current code seems to takes too much memory - and something will need to change (fronted and/or backend) to reduce it.
@Rodrigo, the crash reports ends with:
ABORT("Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS");
Anything else we might suggest ?
@Sebastien, thanks for the quick reply.
Yes, I've tried 'sgen' but that did not change much. As far as I've found so far, the http body can't be handled as a stream... Idd, something will need to change.
That's a boehm limitation that we have no plans on fixing. Switch to sgen.
Closing wrt comment #9 (bohem). From C8 onward sgen is now the only GC available.
The other part of the issue was not solvable using the API available, requiring too much memory, Sadly this is not something we can solve either.