summaryrefslogtreecommitdiff
path: root/py/malloc.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-12-07 17:57:33 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-12-07 18:01:40 +0200
commit9ebc037eee575fd951dea92c82ed9704d9101924 (patch)
treed1a8985d39bf2703e4a7e3b5d016fb72809d3a98 /py/malloc.c
parent88a8043a27c3f75c7e4e52e4e8b0d47005cd6bef (diff)
py/malloc: Allow to use debug logging if !MICROPY_MALLOC_USES_ALLOCATED_SIZE.
This is mostly a workaround for forceful rebuilding of mpy-cross on every codebase change. If this file has debug logging enabled (by patching), mpy-cross build failed.
Diffstat (limited to 'py/malloc.c')
-rw-r--r--py/malloc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/py/malloc.c b/py/malloc.c
index 818a3e57a..6835ed7c9 100644
--- a/py/malloc.c
+++ b/py/malloc.c
@@ -147,7 +147,11 @@ void *m_realloc(void *ptr, size_t new_num_bytes) {
MP_STATE_MEM(current_bytes_allocated) += diff;
UPDATE_PEAK();
#endif
+ #if MICROPY_MALLOC_USES_ALLOCATED_SIZE
DEBUG_printf("realloc %p, %d, %d : %p\n", ptr, old_num_bytes, new_num_bytes, new_ptr);
+ #else
+ DEBUG_printf("realloc %p, %d : %p\n", ptr, new_num_bytes, new_ptr);
+ #endif
return new_ptr;
}
@@ -171,7 +175,11 @@ void *m_realloc_maybe(void *ptr, size_t new_num_bytes, bool allow_move) {
UPDATE_PEAK();
}
#endif
+ #if MICROPY_MALLOC_USES_ALLOCATED_SIZE
DEBUG_printf("realloc %p, %d, %d : %p\n", ptr, old_num_bytes, new_num_bytes, new_ptr);
+ #else
+ DEBUG_printf("realloc %p, %d, %d : %p\n", ptr, new_num_bytes, new_ptr);
+ #endif
return new_ptr;
}
@@ -184,7 +192,11 @@ void m_free(void *ptr) {
#if MICROPY_MEM_STATS
MP_STATE_MEM(current_bytes_allocated) -= num_bytes;
#endif
+ #if MICROPY_MALLOC_USES_ALLOCATED_SIZE
DEBUG_printf("free %p, %d\n", ptr, num_bytes);
+ #else
+ DEBUG_printf("free %p\n", ptr);
+ #endif
}
#if MICROPY_MEM_STATS