How Node-red's memory recycling mechanism works

This suggests that your design is not ideal. The node red way is to pass data using messages, then when a message is finished with the memory will be automatically reclaimed. Flow and global context should generally only be used when it is not practical to pass the data in messages.