Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Get vApplicationMallocFailedHook fail

Posted by vicui on August 23, 2014

Hi:

I use LPCXPRESSO IDE to develop a simple web server on LPC1769, Freertos use HEAP3.c to use system malloc and free funtion. the web server can refresh per 3 second by itself, it works well. but if I refresh it by press F5 frequencty, FreeRTOS reports "DIE:ERROR:FREERTOS: malloc failure !". any problem on it ?


Get vApplicationMallocFailedHook fail

Posted by vicui on August 23, 2014

I also enable use C lib 's malloc and free //#define MEMLIBCMALLOC 1 //#define MEMPMEMMALLOC 1

I think lwip can't free memory on time in more request coming ... it cause malloc fail . but how to fix ? add protect in application ?


Get vApplicationMallocFailedHook fail

Posted by vicui on August 23, 2014

by add unsigned int _checkheapoverflow (void * newendofheap) { unsigned long stackend = ((unsigned long) &vStackTop) - STACKSIZE; return ((unsigned long)newendof_heap >= stackend); } I found that the heap is really overflow once more request incoming. in real application, Freertos use malloc, LWIP also use malloc. so, how to fix the problem ? adding delay time is not a good solution


Get vApplicationMallocFailedHook fail

Posted by edwards3 on August 23, 2014

Just sounds like you are leaking memory somewhere, probably in lwIP port.


Get vApplicationMallocFailedHook fail

Posted by vicui on August 23, 2014

NXP release more version on the LPC1769 demo web server, I try KEIL and LPCXPRESSO, both has the same issue. I don't think LWIP porting has problem. otherwise, the demo server can't refresh itself per 3 seconds for long time.


Get vApplicationMallocFailedHook fail

Posted by rtel on August 23, 2014

So these are demos you are obtaining from NXP rather than from us?

Regards.


Get vApplicationMallocFailedHook fail

Posted by vicui on August 23, 2014

NXP demo is with freertros and lwip. your demo is only for freertos. the issue is only for freertos and lwip. I think the issue is from lwip application, not freertos. I wonder to know how to keep heap safe if freertos and lwip both use C LIB malloc and free.


Get vApplicationMallocFailedHook fail

Posted by edwards3 on August 23, 2014

Is the ethernet driver calling free() from an interrupt? Lots of people do that in lwIP without setting the special lwIP constant that tries to make it safe. If it is freeing from an interrupt that is probably the cause.


Get vApplicationMallocFailedHook fail

Posted by richard_damon on August 24, 2014

I am not familiar with this implementation as I haven't used it, but malloc/free is naturally not thread safe. It is possible to make them thread safe by just disabling interrupts inside them, but this gives lousy interrupt response latency (but will let you use them in interrupts). Some implementations allow you to define a way for malloc to use some form of mutex to make it thread safe. If not, you need to do what FreeRTOS does and use a wrapper, and then everyone needs to use that wrapper.


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists