call to collectgarbage('count') increases memory usage in lua

时间:2016-07-11 18:57:00

标签: memory lua profiling torch

I am a beginner to lua. I am trying to profile the memory usage of my application. When I call collectgarbage('count') repeatedly from lua REPL, the value returned keeps on increasing.

th> collectgarbage()
0
                                                                      [0.0018s]
th> collectgarbage('count')
856.8408203125
                                                                      [0.0001s]
th> collectgarbage('count')
858.669921875
                                                                      [0.0001s]
th> collectgarbage('count')
860.345703125
                                                                      [0.0000s]
th> collectgarbage('count')
862.171875
                                                                      [0.0000s]

Is there any specific reason for this?

1 个答案:

答案 0 :(得分:1)

Thanks to @nicol Bolas and @egor skriptunoff said above,

This is because compiling a lua code allocates memory and also due to string conversion.