Never comment out use strict. Just don't.
In fact, make it help you by defining variables within the scope they are needed, and only there. The memory they take up will be released once the variables go out of scope. That could possibly fix your problem.
Do your print statements give any clue about where your program runs out of memory? If not, I would pare the program down into steps until you can find out where.
But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)