malloc führt zum Absturz



  • Hallo,

    der folgende text ist auf englisch da ich diesen bereits in einem anderem Forum gepostet habe und keine Lust hatte nochmals zu übersetzten. Ich bitte um Nachsicht. 🙂

    I'm developing a C program for an embedded device in order to use it as a pad which is able to recognize handwriting. In short, the program is supposed to extract several features of the signature and calculate a biometric hash.

    Sadly the program keeps crashing as soon as I use malloc or realloc. Since I'm not able to debug the malloc function I can't really see the cause for that.

    int32_t *foobar;
    
    	foobar = malloc( sizeof(int32_t) );   //CRASH
    

    I don't even know where to start looking for a solution so maybe anyone here could give me a solution or a hint to fix it.

    If there is some important information missing please just tell so and I will see if I can add it.

    I'm working with Keil μVision:

    stats for the embedded device
    ARM-7 32bit Architecture
    NXP (Philips) LPC 2368
    72 MHz
    512 kB on-chip Flash
    58kB SRAM

    PS: die SPAM-Filter Regeln in Foren sollten überarbeitet werden^^ ständig landen meine Thread dadrin



  • Hi,
    init_mempool hattest du aufgerufen?



  • CJosef schrieb:

    Hi,
    init_mempool hattest du aufgerufen?

    init_mempool is soweit ich weiß für arm7 architechtur nicht notwendig da der heap bereits in der startdatei definiert wird. Bei C51 kann diese allerdings fehlen.

    Jedenfalls bin ich dadurch mal auf die Idee gekommen mir die Definition des Heaps ma anzsuchauen, bei vorherigen Projekten war dies nie notwendig.

    Dieser war so niedrig eingestellt dass nicht einmal eine allokierung von integer möglich war.

    Habe diesen jetzt manuell erhöht und es funktioniert, hoffentlich ohne weitere Komplikationen.

    Arbeite noch nicht lange im embedded Bereich aber ab und an nervts schon jedes einzelne Bit wie Goldstaub zu behandeln auf Grund des doch sehr begrenzten Speicherplatzes 🙂

    Vielen Dank
    für den Hinweis
    case closed



  • jedes einzelne Bit wie Goldstaub zu behandeln

    ... das ist doch aber das Salz in der Suppe.

    Mit Ressourcen herumassen kann jeder Depp.


Anmelden zum Antworten