Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

Problems with freeing allocated memory (freeRTOS v.8.0)

Posted by kudl4t4 on August 29, 2014

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?


Problems with freeing allocated memory (freeRTOS v.8.0)

Posted by davedoors on August 29, 2014

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.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner