Update memory limit

Based on composer/composer as reported by @reinink. Update memory
limit to 512MB if it is either less than 512MB or not -1 (no
memory limit).

Thanks Composer. :)

Closes #86