Hi there,
I seem to get a strange behavior with 1.40 on windows concerning deallocation.
Basically, I have a managed shared memory segment and I allocate
several blocks of mem in it
typedef boost::interprocess::managed_windows_shared_memory shared_segment;
typedef boost::shared_ptr shared_segment_ptr;
...
shared_segment_ptr p = new shared_segment(create_only,
buffername.c_str(), begin_size);
...
Now I have several allocate_aligned operations:
ptr = m_segment->allocate_aligned(static_cast(rawsize), 128);
Now after a while the segment will have no more room for further
blocks. So I delete some of them to gain more room:
m_segment->deallocate(raw.get());
(raw is an interprocess::offset_ptr)
I debugged into this and there's indeed deallocation functionality
called but when I try to allocate afterwards...
ptr = m_segment->allocate_aligned(static_cast(rawsize), 128);
... I get an interprocess::bad_alloc
This makes me believe that either deallocate didn't do a good job or
I have to do something after the deallocate() to really make it happen.
I looked into the docs for this but there was nothing mentioned so I
suppose deallocate() should suffice.
I think fragmentation is not really a problem here. We're talking about
a few >1MB blocks in a 30MB segment. Plus some administrative overhead.
Any ideas what's going on here?
Cheers,
Stephan