How to check memory leak in a model

A helpful comment from @albanD: