Skip to content
Snippets Groups Projects
Commit 6bd78741 authored by Damien George's avatar Damien George
Browse files

py/gc: When GC threshold is hit don't unnecessarily collect twice.

Without this, if GC threshold is hit and there is not enough memory left to
satisfy the request, gc_collect() will run a second time and the search for
memory will happen again and will fail again.

Thanks to @adritium for pointing out this issue, see #3786.
parent cac2eddc
No related branches found
No related tags found
No related merge requests found
......@@ -453,6 +453,7 @@ void *gc_alloc(size_t n_bytes, bool has_finaliser) {
if (!collected && MP_STATE_MEM(gc_alloc_amount) >= MP_STATE_MEM(gc_alloc_threshold)) {
GC_EXIT();
gc_collect();
collected = 1;
GC_ENTER();
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment