adl_memRelease question


#1

Hi all,

I am trying to release an array, but when i perform the adl_memRelease, I get RTK exception 155.

ascii rsp[100];

…code, etc

adl_memRelease(rsp);

Can I only release non-array variables? Those don’t come up with any errors when released, but arrays seem to.

Please help me to understand this…


#2

You can only release dynamically-allocated memory; you cannot release variables!


#3

It’s obvious when I think about it!

Thanks


#4

Hiya,

Try something like this instead of using stack arrays:

void myFunction()
{
    u8 *myArray;

    myArray = adm_memGet(sizeof(u8) * 100);

    // use array in code

    adl_memRelease(myArray);

    return;
}

This will assign the memory from the heap, rather than the stack (which is relatively small as you have defined the size in your main file somewhere).

ciao, Dave


#5

Thanks for that, Dave