mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-04-20 09:09:02 +00:00
fix(core): check QSTR run-time allocations only for frozen debug builds
[no changelog]
This commit is contained in:
parent
2a40d91790
commit
d50181b7f9
1
.github/workflows/core.yml
vendored
1
.github/workflows/core.yml
vendored
@ -202,6 +202,7 @@ jobs:
|
||||
- run: nix-shell --run "poetry run make -C core build_unix"
|
||||
- run: nix-shell --run "cd vendor/ts-tvl/tvl/server/model_config && poetry install && poetry run model_server tcp -c model_config.yml &"
|
||||
- run: nix-shell --run "poetry run make -C core test"
|
||||
- run: nix-shell --run "poetry run core/emu.py -c true" # sanity check non-frozen emulator
|
||||
|
||||
core_unit_rust_test:
|
||||
name: Rust unit tests
|
||||
|
@ -306,8 +306,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_trezorutils_enable_oom_dump_obj,
|
||||
/// def check_heap_fragmentation() -> None:
|
||||
/// """
|
||||
/// Assert known sources for heap fragmentation.
|
||||
/// Enabled only for frozen debug builds.
|
||||
/// """
|
||||
STATIC mp_obj_t mod_trezorutils_check_heap_fragmentation(void) {
|
||||
#if MICROPY_MODULE_FROZEN_MPY
|
||||
mp_obj_dict_t *modules = &MP_STATE_VM(mp_loaded_modules_dict);
|
||||
if (modules->map.alloc > MICROPY_LOADED_MODULES_DICT_SIZE) {
|
||||
mp_raise_msg(&mp_type_AssertionError, "sys.modules dict is reallocated");
|
||||
@ -336,6 +338,7 @@ STATIC mp_obj_t mod_trezorutils_check_heap_fragmentation(void) {
|
||||
" total bytes",
|
||||
n_pool, n_qstr, n_str_data_bytes, n_total_bytes);
|
||||
}
|
||||
#endif // MICROPY_MODULE_FROZEN_MPY
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_trezorutils_check_heap_fragmentation_obj,
|
||||
|
@ -108,6 +108,7 @@ if __debug__:
|
||||
def check_heap_fragmentation() -> None:
|
||||
"""
|
||||
Assert known sources for heap fragmentation.
|
||||
Enabled only for frozen debug builds.
|
||||
"""
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user