Do not try to parse memory limit if empty
Extract memory limit parsing code
Simplify condition

Negative value will not match length of a string anyway.
Coding style: wrap long lines
Remove commented out code

That's why we have version control...
Wrap long line