fixes #2 : greedy realloc.

Signed-off-by: Wilfried Chauveau <ithinuel@gmail.com>
Merge pull request #3 from ithinuel/fix_memmgr

fixes #2 : greedy realloc.