Fix a bug in computing memory requirements
Merge pull request #24 from shivaram/v2

Fix a bug in computing memory requirements