Boost logo

Boost Users :

From: Shen, Chang (MSFC-EV43) (chang.shen-1_at_[hidden])
Date: 2020-03-07 00:17:30


Hi All
I am testing my class using boost. The class has a shared_memory_object member :
class X
{
                char* m_buffer;
               boost::interprocess::shared_memory_object *m_sram;
               public X(char *name)
               {
                   m_buffer = (char*)malloc(128);
                   m_sram = new(std::nothrow) boost::interprocess::shared_memory_object(boost::interprocess::open_or_create_t,
                                                                 name,
                                                                boost::interprocess::mode_t::read_write);

               }
}

int main()
{
    std::vector<X*> xlist;
    for(int i=0;i<1500;i++)
    {
        std::string name = std::to_string(i);
        X *x = new(std::nothrow) (name.c_str());
        xlist.push_back(x);

    }
    return 0;
}
I test the class in Window 10 using MinGW 32bit compiler.

g++ (MinGW.org GCC-8.2.0-3) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I find that I only can create 1463 X objects.
1464th object will throw exception:
Dynamic exception type: boost::interprocess::interprocess_exception
std::exception::what: WinApi FormatMessage returned error.

Why this limitation?



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