diff options
author | Damien George <damien.p.george@gmail.com> | 2015-01-11 14:37:06 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-01-11 14:37:06 +0000 |
commit | ec21405821dd997d337a0f387db9b1a45b32834b (patch) | |
tree | 07bfbff42da79627368766d1ce84f5a0b5400dec | |
parent | 56e1f99ca1412a580eb3da5622cec5e66d9063d0 (diff) | |
download | micropython-ec21405821dd997d337a0f387db9b1a45b32834b.tar.gz micropython-ec21405821dd997d337a0f387db9b1a45b32834b.zip |
py: Add (commented out) code to gc_dump_alloc_table for qstr info.
-rw-r--r-- | py/gc.c | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -730,7 +730,26 @@ void gc_dump_alloc_table(void) { #endif else if (*ptr == (mp_uint_t)&mp_type_fun_bc) { c = 'B'; } else if (*ptr == (mp_uint_t)&mp_type_module) { c = 'M'; } - else { c = 'h'; } + else { + c = 'h'; + #if 0 + // This code prints "Q" for qstr-pool data, and "q" for qstr-str + // data. It can be useful to see how qstrs are being allocated, + // but is disabled by default because it is very slow. + for (qstr_pool_t *pool = MP_STATE_VM(last_pool); c == 'h' && pool != NULL; pool = pool->prev) { + if ((qstr_pool_t*)ptr == pool) { + c = 'Q'; + break; + } + for (const byte **q = pool->qstrs, **q_top = pool->qstrs + pool->len; q < q_top; q++) { + if ((const byte*)ptr == *q) { + c = 'q'; + break; + } + } + } + #endif + } break; } case AT_TAIL: c = 't'; break; |