Skip to content

Commit

Permalink
For UMM_CRITICAL_METRICS fixed time_stats initializer. (#7390)
Browse files Browse the repository at this point in the history
* 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"
  • Loading branch information
mhightower83 committed Jun 21, 2020
1 parent 7298691 commit b263888
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cores/esp8266/heap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extern "C" {
#undef realloc
#undef free

#elif defined(DEBUG_ESP_OOM)
#elif defined(DEBUG_ESP_OOM) || defined(UMM_INTEGRITY_CHECK)
#define UMM_MALLOC(s) umm_malloc(s)
#define UMM_CALLOC(n,s) umm_calloc(n,s)
#define UMM_REALLOC_FL(p,s,f,l) umm_realloc(p,s)
Expand Down
2 changes: 1 addition & 1 deletion cores/esp8266/umm_malloc/umm_local.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ UMM_TIME_STATS time_stats = {
#ifdef UMM_INFO
{0xFFFFFFFF, 0U, 0U, 0U},
#endif
#ifdef UMM_POISON_CHECK
#if defined(UMM_POISON_CHECK) || defined(UMM_POISON_CHECK_LITE)
{0xFFFFFFFF, 0U, 0U, 0U},
#endif
#ifdef UMM_INTEGRITY_CHECK
Expand Down
18 changes: 15 additions & 3 deletions cores/esp8266/umm_malloc/umm_malloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,9 +647,21 @@ void *umm_realloc( void *ptr, size_t size ) {

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

//C This has changed need to review and see if UMM_REALLOC_MINIMIZE_COPY really
//C is that any more. or is it equivalent or close enough to my defrag
//C - mjh
//C With each upstream update this section should be reevaluated.
/*C
*
* The `#if defined(UMM_REALLOC_MINIMIZE_COPY)` section tracks the content of
* the upstream with some local macros added. Back when I made my 1st update to
* umm_malloc PR, I found the upstream had been refactored and removed the
* defragmenting properties that were originally present. It took some looking
* to see the logic, it didn't have any comments to make it stand out.
*
* I added the `#elif defined(UMM_REALLOC_DEFRAG)` to recreate and preserve the
* defragmenting functionality that was lost. This is the default build option
* we have set in `umm_malloc_cfg.h`. I have not done any structured testing to
* confirm; however, I think this to be the best option when considering the
* amount of reallocates that can occur with the Strings library.
*/
#if defined(UMM_REALLOC_MINIMIZE_COPY)
/*
* Ok, now that we're here we know how many blocks we want and the current
Expand Down
2 changes: 1 addition & 1 deletion cores/esp8266/umm_malloc/umm_poison.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static bool check_poison( const void *ptr, size_t poison_size,
* blocks.
*/
static bool check_poison_block( umm_block *pblock ) {
int ok = true;
bool ok = true;

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

0 comments on commit b263888

Please sign in to comment.