Hi Berenguer,
If you do segment.allocate(3) many times you end up NOT using 100% of the available space but MUCH less.
Every dynamic allocatio needs to store deallocation information to know the size of the buffer, perform buffer merging, etc... Apart from that, an allocation has normally to fulfill some alignment constraints. In the default Shmem allocation algorithm, 8 bytes are used per allocation to store that information and the alignment is 8 bytes. This means that when you want to allocate 3 bytes, you need to use 16 bytes of memory. That's why you run out of memory. Remember that the initial size or the segment will never be fully used: depends on the number of allocation and the size of that allocation. This is exactly the same that happens with "operator new": you waste much more memory with many small allocations than with a few big ones. Regards, Ion