mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-10-24 03:55:27 +08:00
feat(heap): add option to enable/disable heap trace function
This commit is contained in:
@@ -32,7 +32,9 @@ extern heap_region_t g_heap_region[];
|
||||
|
||||
static const char *TAG = "heap_init";
|
||||
size_t g_heap_region_num;
|
||||
#ifdef CONFIG_HEAP_TRACING
|
||||
int __g_heap_trace_mode = HEAP_TRACE_NONE;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Initialize regions of memory to the collection of heaps at runtime.
|
||||
@@ -116,7 +118,9 @@ void IRAM_ATTR *_heap_caps_malloc(size_t size, uint32_t caps, const char *file,
|
||||
|
||||
_heap_caps_lock(num);
|
||||
|
||||
#ifdef CONFIG_HEAP_TRACING
|
||||
trace = __g_heap_trace_mode == HEAP_TRACE_LEAKS;
|
||||
#endif
|
||||
|
||||
mem_blk_size = ptr2memblk_size(size, trace);
|
||||
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef CONFIG_HEAP_TRACING
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "esp_heap_caps.h"
|
||||
@@ -146,3 +150,5 @@ void heap_trace_dump(void)
|
||||
_heap_caps_unlock(num);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_HEAP_TRACING */
|
||||
|
||||
Reference in New Issue
Block a user