1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-05 12:42:22 +03:00

Use umm_malloc for heap management

This commit is contained in:
Ivan Grokhotkov
2016-02-04 13:14:47 +03:00
parent 2e1be32825
commit 339140c756
11 changed files with 2479 additions and 16 deletions

43
cores/esp8266/heap.c Normal file
View File

@ -0,0 +1,43 @@
/* heap.c - overrides of SDK heap handling functions
* Copyright (c) 2016 Ivan Grokhotkov. All rights reserved.
* This file is distributed under MIT license.
*/
#include <stdlib.h>
#include "umm_malloc/umm_malloc.h"
#include <c_types.h>
void* ICACHE_RAM_ATTR pvPortMalloc(size_t size, const char* file, int line)
{
return malloc(size);
}
void ICACHE_RAM_ATTR vPortFree(void *ptr, const char* file, int line)
{
free(ptr);
}
void* ICACHE_RAM_ATTR pvPortCalloc(size_t count, size_t size, const char* file, int line)
{
return calloc(count, size);
}
void* ICACHE_RAM_ATTR pvPortRealloc(void *ptr, size_t size, const char* file, int line)
{
return realloc(ptr, size);
}
void* ICACHE_RAM_ATTR pvPortZalloc(size_t size, const char* file, int line)
{
return calloc(1, size);
}
size_t ICACHE_RAM_ATTR xPortGetFreeHeapSize(void)
{
return umm_free_heap_size();
}
void system_show_malloc(void)
{
umm_info(NULL, 1);
}