Boost logo

Boost Users :

From: alexmark (talamar.lands_at_[hidden])
Date: 2006-09-18 09:44:47


I have the problem with VC8 release build (all release build options - by
default, i.e., optimization is "Maximize speed /O2" and so on).
A run of "repro" output executable finishes with the exception on attempt to
read data from address 0.

I noticed it for boost::interprocess (and boost::shmem too) allocators of
type:
- node_allocator
- cached_node_allocator
and not to:
- allocator
- private_node_allocator

The way out I found (for "problematic" allocator types) is to set additional
compiler option "/Og-" (already declared deprecated).
With VC7.1 it all is ok for any allocator type w/o setting /Og- or any other
additional options.

Have anyone noticed this problem? Where the problem originates from? VC8
optimization specifics (NRVO is affected by /Og option)?
Or smth. wrong in "repro" code?
Thanks.

//////////////

The "repro" code is the following:

#include "stdafx.h"
#include <boost/interprocess/managed_external_buffer.hpp>
#include <boost/interprocess/allocators/node_allocator.hpp>
#include <boost/interprocess/containers/list.hpp>

using namespace boost::interprocess;

enum { A_SHARED_MEMORY_SIZE = 65536, A_POOL_SIZE = 64 };

typedef node_allocator<int, A_POOL_SIZE,
managed_external_buffer::segment_manager> user_allocator_t;
typedef list<int, user_allocator_t> MyUserList;

int _tmain(int argc, _TCHAR* argv[])
{
    static char static_buffer[A_SHARED_MEMORY_SIZE];
    managed_external_buffer user_buffer(create_only, static_buffer,
A_SHARED_MEMORY_SIZE);
    MyUserList *userlist =
user_buffer.construct<MyUserList>("MyUserList")(user_buffer.get_segment_manager());
    return 0;
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net