[gdal-dev] Memory allocation issues on Android 11+ and scudo

Greg Troxel gdt at lexort.com
Mon Mar 28 06:16:30 PDT 2022


Philippe Lelong <lelong.ph at meltemus.com> writes:

> What I can see is that the memory grows exponentially until no more
> memory is available and crash, even on systems with huge memory
> available while an Android device without SCUDO and very limited
> memory (let's say 4Gb) in the same exact conditions, with the same
> apk, runs perfectly. The logcat command show this:

You said "exponentially" but you didn't attach a graph of usage, so I
have no idea if you really mean exponentially and what exponent :-)

I also can't tell what "huge memory" means and if that's android or not.

You didn't give the build recipe; I'm assuming this is inside an apk
using NDK, but it could be within termux.

> 03-28 12:40:34.255  4959  5005 W libc    : malloc(264196) failed: returning null pointer
> 03-28 12:40:34.255  4959  5005 W libc    : malloc(264196) failed: returning null pointer
> 03-28 12:40:34.256  4959  5005 W libc    : malloc(264196) failed: returning null pointer
> 03-28 12:40:34.256  4959  5005 W libc    : malloc(264196) failed: returning null pointer
> 03-28 12:40:34.612   630   630 D io_stats: !@ Write_top(KB): kworker/u16:1(32583) 8
> 03-28 12:40:34.820  4959  5041 I scudo   : Scudo ERROR: out of memory trying to allocate 64 bytes
> 03-28 12:40:34.820  4959  5042 I scudo   : Scudo ERROR: out of memory trying to allocate 64 bytes
> 03-28 12:40:34.820  4959  5033 I scudo   : Scudo ERROR: out of memory trying to allocate 64 bytes
> 03-28 12:40:34.820  4959  5031 I scudo   : Scudo ERROR: out of memory trying to allocate 64 bytes
> 03-28 12:40:34.820  4959  5038 I scudo   : Scudo ERROR: out of memory trying to allocate 64 bytes
> 03-28 12:40:34.820  4959  5040 I scudo   : Scudo ERROR: out of memory trying to allocate 64 bytes

It seems obvious that you should use some kind of malloc debugging that
has a trace of malloc/free to a log and then postprocess it.

Keep in mind that the bug could be in this other allocator.  I'm not
saying it's likely, just that it's best not to make assumptions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220328/da734496/attachment.sig>


More information about the gdal-dev mailing list