Opened 10 years ago

Closed 10 years ago

#7795 closed Bugs (fixed)

Bug creating structures in files mapped with small sizes

Reported by: lodos@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.52.0 Severity: Problem
Keywords: mapped file size Cc:

Description

To reproduce the bug one could use doc_managed_mapped_file.cpp in the example folder. Set the FileSize variable to small values (less than 100 for instance) and the construct method will cause a crash. An exception is expected instead.

For completeness I include below our exchange in the boost developer list. Thank you.

When the size to map is too small, take 1 or 2 bytes for instance, the library fails in a non elegant way. This is a corner case, but I could not find this documented. Is this a bug?

You need a minimum size to construct managed memory's internal structures. Maybe the behaviour should be documented. What do you

mean

with "non-elegant", your application crashses? Nevertheless, mapping

1

or 2 bytes you waste resources, as the OS will map at least one page (4K on most 32 bit systems and 64 K on Windows).

Yes, the application crashes. I am mapping large complex containers with different sizes, the crashes took place when I was developing tests. I would expect an exception when the size of the mapping is not enough. It is time consuming to develop a structure that would need more than 4Kb for its initial mapping. if I create a ticket with a sample using a few bytes just to demonstrate the problem, would you consider it? I understand this is not a show stopper :-) Thank you for your answers and again for boost::interprocess.

This seems a bug, please fill another ticket with your example.

Change History (1)

comment:1 by Ion Gaztañaga, 10 years ago

Resolution: fixed
Status: newclosed

Fixed in revision #82245 in trunk

Note: See TracTickets for help on using tickets.