FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [August 2014 Threads]
My code looks like
~~~~~~
/------ VARIABLES ------/
uint8t how;
typedef struct {
uint8t *nfcid;
} Test;
typedef union {
Test here;
} Haha;
Haha *haha;
/------ FUNCTIONS ------/
void memoryAlloc( Haha **haha ) {
Haha *h =(Haha *)pvPortMalloc( (1) * sizeof(Haha) );
*haha = h;
uint8t *r =(uint8t )pvPortMalloc( (1) * sizeof(uint8_t) );
*r = 0x0F+how;
(haha)->here.nfcid = r;
}
void freeAlloc( Haha *haha ) {
vPortFree(haha->tutaj.nfcid);
vPortFree(haha);
}
/------ MAIN ------/
void main() {
how++;
memoryAlloc(&haha);
freeAlloc(haha);
}
~~~~~~
and it seems like vPortFree doesn't free memory. What may be the problem?
Your use of pointers to pointers is too mind bending for me to be able to work it out, and I don't know where tutaj came from at all. Try creating a dummy application is something like MingW that runs the code with normal C lib mallocs and frees then step the code to see what it's doing.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.