Memory cap for buffer

Each buffer instance has a memory cap, thus avoiding using all the memory in
one go.