1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-14 03:30:02 +00:00

fix(core): create try-catch around displaying the number of allocations

[no changelog]
This commit is contained in:
M1nd3r 2024-09-02 16:36:26 +02:00
parent 89820e84ed
commit 206c01a5c0

View File

@ -64,9 +64,13 @@ async def handle_received_message(
if __debug__:
log.debug(__name__, "handle_received_message")
import micropython
micropython.mem_info()
print(micropython.alloc_count())
try:
import micropython
micropython.mem_info()
print("Allocation count:", micropython.alloc_count())
except AttributeError:
print("To show allocation count, create the build with TREZOR_MEMPERF=1")
ctrl_byte, _, payload_length = ustruct.unpack(">BHH", message_buffer)
message_length = payload_length + INIT_HEADER_LENGTH