diff --git a/components/micropython/vendor/py/qstr.c b/components/micropython/vendor/py/qstr.c
index 3daba6e5693184ed320b719ae05fc88f339a5ec9..6641c460c95a209aa126e1b9242cb36132f4ac34 100644
--- a/components/micropython/vendor/py/qstr.c
+++ b/components/micropython/vendor/py/qstr.c
@@ -137,6 +137,7 @@ STATIC const qstr_pool_t *find_qstr(qstr *q) {
 // qstr_mutex must be taken while in this function
 STATIC qstr qstr_add(mp_uint_t hash, mp_uint_t len, const char *q_ptr) {
     DEBUG_printf("QSTR: add hash=%d len=%d data=%.*s\n", hash, len, len, q_ptr);
+    gc_collect();
 
     // make sure we have room in the pool for a new qstr
     if (MP_STATE_VM(last_pool)->len >= MP_STATE_VM(last_pool)->alloc) {