Opened 8 years ago
#10629 new Bugs
Interprocess Vector resize causes crash
Reported by: | Owned by: | Ion Gaztañaga | |
---|---|---|---|
Milestone: | To Be Determined | Component: | interprocess |
Version: | Boost 1.56.0 | Severity: | Problem |
Keywords: | interprocess, vector | Cc: |
Description
Our existing code that has worked through many versions of Boost has failed in Boost 1.56.0.
I've reduced our code down to a specific example that replicates the issue in the following development environment:
(1) Windows 7 64-bit (2) VS2010 and VS2013 (generating X64 code)
The example code produces a tree-like structure. Each node contains an interprocess vector that contains child nodes. The depth of the tree is 3 (parent, child, grandchild). The parent (root) node contains D child nodes, each child node contains D grandchild nodes, and the children of the grandchild nodes are left empty. The example program crashes when using a dimension, D, of 43, but is fine for 42 and less.
The tree is constructed in a depth-first process so there will be some resizing of the vectors in the child and parent nodes after the grandchild nodes have been created and added to the structure.
The crash generates the following error:
Assertion failed: ptr != 0, file D:\boost64\include\boost-1_56\boost/interprocess/allocators/allocator.hpp, line 268
The crash can be prevented by reserving the correct amount of space ahead of node insertion.
Sample code is available: github.com/peter-durrant/sandbox/tree/master/boost_interprocess_vector_broken (CPP file attached)
Example code demonstrating crash