If it works like I wanted to have it work it should not free up anything. as there is the check:

if (allocs < size()) which should fail. No ?