Intel Moe Project Porting Problem

Hı,
i was developing my project intel mos, when i ported to open source mos
there is an memory exception, my app was not throwing exception at that point while using intel mos,
exception is below,
what can be causes that excepiton ?
i did not change any code while porting (i run my app in iphone 5 phone, not emulator),
can cause proguard or something like configuration based problem ?

art W   580 211639 /Volumes/SSD/gh-moe-master/aosp/art/runtime/native/java_lang_Runtime.cc:65] android_update_LD_LIBRARY_PATH not found; .so dependencies will not work!
2016-09-06 00:33:10.245 My App[580:211639] Can't find keyplane that supports type 4 for keyboard iPhone-Portrait-NumberPad; using 563160167_Portrait_iPhone-Simple-Pad_Default
2016-09-06 00:33:16.853 My App[580:211639] Can't find keyplane that supports type 4 for keyboard iPhone-Portrait-NumberPad; using 563160167_Portrait_iPhone-Simple-Pad_Default
Sep 6, 2016 12:33:24 AM org.com.myapp.ui.tasks.SendWsTask doInBackground
INFO: SendWsTask
art I   580 211690 /Volumes/SSD/gh-moe-master/aosp/art/runtime/gc/heap.cc:2714] Alloc concurrent mark sweep GC freed 24704(916KB) AllocSpace objects, 1(260KB) LOS objects, 62% free, 2MB/6MB, paused 1.033ms total 40.868ms
art I   580 211690 /Volumes/SSD/gh-moe-master/aosp/art/runtime/gc/heap.cc:2714] Alloc sticky concurrent mark sweep GC freed 87(1392B) AllocSpace objects, 0(0B) LOS objects, 62% free, 2MB/6MB, paused 998us total 8.296ms
art I   580 211690 /Volumes/SSD/gh-moe-master/aosp/art/runtime/gc/heap.cc:2714] Alloc concurrent mark sweep GC freed 660(23KB) AllocSpace objects, 0(0B) LOS objects, 62% free, 2MB/6MB, paused 810us total 21.724ms
art W   580 211690 /Volumes/SSD/gh-moe-master/aosp/art/runtime/thread.cc:2375] Throwing OutOfMemoryError "Failed to allocate a 420415544 byte allocation with 4194304 free bytes and 125MB until OOM"
art I   580 211690 /Volumes/SSD/gh-moe-master/aosp/art/runtime/gc/heap.cc:2714] Alloc sticky concurrent mark sweep GC freed 4(448B) AllocSpace objects, 0(0B) LOS objects, 62% free, 2MB/6MB, paused 794us total 7.053ms
art I   580 211690 /Volumes/SSD/gh-moe-master/aosp/art/runtime/gc/heap.cc:2714] Alloc concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 62% free, 2MB/6MB, paused 813us total 21.995ms
art I   580 211690 /Volumes/SSD/gh-moe-master/aosp/art/runtime/gc/heap.cc:2714] Alloc concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 62% free, 2MB/6MB, paused 729us total 20.985ms
art W   580 211690 /Volumes/SSD/gh-moe-master/aosp/art/runtime/thread.cc:2375] Throwing OutOfMemoryError "Failed to allocate a 420415544 byte allocation with 4194304 free bytes and 125MB until OOM"
2016-09-06 00:33:25.049 My App[580:211690] *** Terminating app due to uncaught exception 'java.lang.OutOfMemoryError', reason: 'java.lang.OutOfMemoryError: Failed to allocate a 420415544 byte allocation with 4194304 free bytes and 125MB until OOM
    at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:95)
    at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:146)
    at java.lang.StringBuilder.append(StringBuilder.java:216)
    at org.kxml2.io.KXmlParser.setProperty(KXmlParser.java:2110)
    at org.ksoap2.transport.Transport.parseResponse(Transport.java:127)
    at org.ksoap2.transport.HttpTransportSE.parseResponse(HttpTransportSE.java:301)
    at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:274)
    at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118)
    at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:113)
    at com.android.SoapRequests.getParams(SoapRequests.java:48)
    at com.android.callWs(MyConnect.java:107)
    at org.com.myapp.ui.tasks.SendWsTask.doInBackground(SendWsTask.java:79)
    at org.com.myapp.ui.asycntasks.AsyncTask$1.call_dispatch_async(AsyncTask.java:38)
'
*** First throw call stack:
(0x21695b0b 0x20e52dff 0x40aab55 0x40b2329 0x40ba621 0x40b80a4 0x212336a1 0x2123307b 0x213c6e0d 0x213c69fc)
libc++abi.dylib: terminating with uncaught exception of type ObjCException

Dear kurul,

It seems like you are trying to allocate a ~400MB memory region. This may be possible, but you need to make some changes. I would suggest to re-create your project with the ‘Keep Xcode Project’ option enabled. This way your can edit your Xcode project’s main.cpp file and change it to something like this:

#include <MOE/MOE.h>
#include <string.h>
#include <alloca.h>

int main(int argc, char *argv[]) {
    char** argv2 = (char **)alloca(sizeof(char*) * (argc + 1));
    argv2[0] = argv[0];
    argv2[1] = strdup("-Xmx512m");
    for (int i = 1; i < argc; ++i) argv2[i + 1] = argv[i];
    return moevm(argc + 1, argv2);
}
2 Likes

Thanks a lot ,
i modified main.cpp as you described, maxmemory now increased to 512 MB.
But when i modified cpp file i can not debug in android studio, if i undo my changes on cpp file and bring cpp file to original version, i can again debug on java source files.
How can activate debugger again in the case of main.cpp is modified ?

Dear kurul,

I updated my previous answer with a proper implementation. You should have debug support with it.

Thanks it is working,
Awesome !