Skip to content

Commit b263888

Browse files
authored
For UMM_CRITICAL_METRICS fixed time_stats initializer. (#7390)
* Corrected missed edit in check_poison_block() change variable ok to bool. Updated time_stats (used by UMM_CRITICAL_METRICS) initializer to include UMM_POINSON_CHECK_LITE. Update maintenace comment block for UMM_REALLOC_... * Add missing defined(UMM_INTEGRITY_CHECK) to heap.cpp. Fixes build case of UMM_INTEGRITY_CHECK and Debug port: "disabled"
1 parent 7298691 commit b263888

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

cores/esp8266/heap.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extern "C" {
2020
#undef realloc
2121
#undef free
2222

23-
#elif defined(DEBUG_ESP_OOM)
23+
#elif defined(DEBUG_ESP_OOM) || defined(UMM_INTEGRITY_CHECK)
2424
#define UMM_MALLOC(s) umm_malloc(s)
2525
#define UMM_CALLOC(n,s) umm_calloc(n,s)
2626
#define UMM_REALLOC_FL(p,s,f,l) umm_realloc(p,s)

cores/esp8266/umm_malloc/umm_local.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ UMM_TIME_STATS time_stats = {
1515
#ifdef UMM_INFO
1616
{0xFFFFFFFF, 0U, 0U, 0U},
1717
#endif
18-
#ifdef UMM_POISON_CHECK
18+
#if defined(UMM_POISON_CHECK) || defined(UMM_POISON_CHECK_LITE)
1919
{0xFFFFFFFF, 0U, 0U, 0U},
2020
#endif
2121
#ifdef UMM_INTEGRITY_CHECK

cores/esp8266/umm_malloc/umm_malloc.cpp

+15-3
Original file line numberDiff line numberDiff line change
@@ -647,9 +647,21 @@ void *umm_realloc( void *ptr, size_t size ) {
647647

648648
DBGLOG_DEBUG( "realloc blocks %d blockSize %d nextBlockSize %d prevBlockSize %d\n", blocks, blockSize, nextBlockSize, prevBlockSize );
649649

650-
//C This has changed need to review and see if UMM_REALLOC_MINIMIZE_COPY really
651-
//C is that any more. or is it equivalent or close enough to my defrag
652-
//C - mjh
650+
//C With each upstream update this section should be reevaluated.
651+
/*C
652+
*
653+
* The `#if defined(UMM_REALLOC_MINIMIZE_COPY)` section tracks the content of
654+
* the upstream with some local macros added. Back when I made my 1st update to
655+
* umm_malloc PR, I found the upstream had been refactored and removed the
656+
* defragmenting properties that were originally present. It took some looking
657+
* to see the logic, it didn't have any comments to make it stand out.
658+
*
659+
* I added the `#elif defined(UMM_REALLOC_DEFRAG)` to recreate and preserve the
660+
* defragmenting functionality that was lost. This is the default build option
661+
* we have set in `umm_malloc_cfg.h`. I have not done any structured testing to
662+
* confirm; however, I think this to be the best option when considering the
663+
* amount of reallocates that can occur with the Strings library.
664+
*/
653665
#if defined(UMM_REALLOC_MINIMIZE_COPY)
654666
/*
655667
* Ok, now that we're here we know how many blocks we want and the current

cores/esp8266/umm_malloc/umm_poison.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static bool check_poison( const void *ptr, size_t poison_size,
6969
* blocks.
7070
*/
7171
static bool check_poison_block( umm_block *pblock ) {
72-
int ok = true;
72+
bool ok = true;
7373

7474
if (pblock->header.used.next & UMM_FREELIST_MASK) {
7575
DBGLOG_ERROR( "check_poison_block is called for free block 0x%lx\n", (unsigned long)pblock);

0 commit comments

Comments
 (0)