espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.76k stars 741 forks source link

Free in reverse order #2325

Closed notEvil closed 1 year ago

notEvil commented 1 year ago

Currently, StringExt blocks as well as children are freed in order. This leads to backward links, e.g.

1: String 2: StringExt 3: StringExt

creates 1 -> 3 -> 2 and

1: Object 2: first name or index 3: first value 4: second name or index 5: second value

creates 1 -> 4 -> 5 -> 2 -> 3

This PR reverses the order. It shouldn't have a significant performance impact but lead to less fragmentation and less frequent GC

gfwilliams commented 1 year ago

Thanks for that recent change - this looks great!

notEvil commented 1 year ago

You are most welcome :)