mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 01:29:58 +01:00
[python] Update to MicroPython 1.9.4
This commit is contained in:
committed by
EmilieNumworks
parent
caff93cda0
commit
73250e727a
@@ -39,6 +39,9 @@
|
||||
#endif
|
||||
|
||||
#if MICROPY_MEM_STATS
|
||||
#if !MICROPY_MALLOC_USES_ALLOCATED_SIZE
|
||||
#error MICROPY_MEM_STATS requires MICROPY_MALLOC_USES_ALLOCATED_SIZE
|
||||
#endif
|
||||
#define UPDATE_PEAK() { if (MP_STATE_MEM(current_bytes_allocated) > MP_STATE_MEM(peak_bytes_allocated)) MP_STATE_MEM(peak_bytes_allocated) = MP_STATE_MEM(current_bytes_allocated); }
|
||||
#endif
|
||||
|
||||
@@ -114,9 +117,6 @@ void *m_malloc_with_finaliser(size_t num_bytes) {
|
||||
|
||||
void *m_malloc0(size_t num_bytes) {
|
||||
void *ptr = m_malloc(num_bytes);
|
||||
if (ptr == NULL && num_bytes != 0) {
|
||||
m_malloc_fail(num_bytes);
|
||||
}
|
||||
// If this config is set then the GC clears all memory, so we don't need to.
|
||||
#if !MICROPY_GC_CONSERVATIVE_CLEAR
|
||||
memset(ptr, 0, num_bytes);
|
||||
@@ -144,7 +144,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;
|
||||
}
|
||||
|
||||
@@ -168,7 +172,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;
|
||||
}
|
||||
|
||||
@@ -181,7 +189,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
|
||||
|
||||
Reference in New Issue
Block a user