mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
heap: fix multi_heap_get_info_impl
This commit is contained in:
parent
6cd0ae8cbf
commit
0028e2c23c
@ -1,16 +1,8 @@
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
@ -360,6 +352,8 @@ static void multi_heap_get_info_tlsf(void* ptr, size_t size, int used, void* use
|
||||
|
||||
void multi_heap_get_info_impl(multi_heap_handle_t heap, multi_heap_info_t *info)
|
||||
{
|
||||
uint32_t sl_interval;
|
||||
|
||||
memset(info, 0, sizeof(multi_heap_info_t));
|
||||
|
||||
if (heap == NULL) {
|
||||
@ -371,6 +365,9 @@ void multi_heap_get_info_impl(multi_heap_handle_t heap, multi_heap_info_t *info)
|
||||
info->total_allocated_bytes = (heap->pool_size - tlsf_size()) - heap->free_bytes;
|
||||
info->minimum_free_bytes = heap->minimum_free_bytes;
|
||||
info->total_free_bytes = heap->free_bytes;
|
||||
info->largest_free_block = info->largest_free_block ? 1 << (31 - __builtin_clz(info->largest_free_block)) : 0;
|
||||
if (info->largest_free_block) {
|
||||
sl_interval = (1 << (31 - __builtin_clz(info->largest_free_block))) / SL_INDEX_COUNT;
|
||||
info->largest_free_block = info->largest_free_block & ~(sl_interval - 1);
|
||||
}
|
||||
multi_heap_internal_unlock(heap);
|
||||
}
|
||||
|
@ -1470,7 +1470,6 @@ components/heap/include/esp_heap_trace.h
|
||||
components/heap/include/heap_memory_layout.h
|
||||
components/heap/include/multi_heap.h
|
||||
components/heap/include/soc/soc_memory_layout.h
|
||||
components/heap/multi_heap.c
|
||||
components/heap/multi_heap_config.h
|
||||
components/heap/multi_heap_internal.h
|
||||
components/heap/multi_heap_platform.h
|
||||
|
Loading…
Reference in New Issue
Block a user