pikasTech / PikaPython

An ultra-lightweight Python interpreter that runs with only 4KB of RAM, zero dependencies. It is ready to use out of the box without any configuration required and easy to extend with C. Similar project: MicroPython, JerryScript.
http://pikapython.com/
MIT License
1.45k stars 132 forks source link

Fix memory leak in event queue #316

Closed randyscott closed 1 year ago

randyscott commented 1 year ago

If the event queue becomes full and an event needs to be discarded, the VM could leak memory because the arg type was still set to ARG_TYPE_OBJECT_NEW instead of ARG_TYPE_OBJECT.

This change moves the arg_deinit() until after the arg type is changed.

pikasTech commented 1 year ago

Thank you for your proposed modifications. Your analysis appears to be very reasonable, and after thorough testing, I hope that these changes can be successfully merged. Thank you once again!

pikasTech commented 1 year ago

Thank you for your valuable code contribution. We'd like to send a 2023 PIKAPYTHON gift to you. Do you have a China mainland address we could use? @randyscott