Readjusting the amount of allocated memory. Fixes #367

Here's the actual pull request for the "Possible memory management issue?" #367