fix oom error
Merge pull request #1204 from LorenzoBoccaccia/fix-oom

fix oom error