Ok, so the problem is coming from running it in the editor, if I run it in a new editor window the ram usage is normal.