I’ve got an array A that when it’s filled takes up ~6mb of system memory. i then perform functions on it and write the results to an array B (array B takes up ~8mb of system memory). I then nil the contents of array A and the array itself, however the program prints out ive got ~15mb of system memory used. i then have memory leaks of about 30kb every three seconds and after time, the memory resets to about 8-9mb which seems fine. im just wondering why lua’s garbage collector doesn’t clean up straight away after i free A;
maybe i dont need to have an array B and just rewrite to A once im done with one element i.e. after performing functions on A[1], i can nil A[1] and then rewrite to it from temp variables that recorded the results? (would this show 8-9mb instead of 15mb of system memory usage?)
it feels like i dont have to worry as much because it does eventually reset, but im just a bit confused about how the garbage collector works,
cheers,
boris