shared memory objects limitation in Windows 10

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?

On 07/03/2020 1:17, Shen, Chang (MSFC-EV43) via Boost-users wrote:
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.
1464^th object will throw exception:
Dynamic exception type: boost::interprocess::interprocess_exception
std::exception::what: WinApi FormatMessage returned error.
Why this limitation?
A shared memory object creates a file. You can hit the file descriptor limit of the OS. However the "WinApi FormatMessage" error tells nothing, so a bug report would be welcome. Best, Ion
participants (2)
-
Ion Gaztañaga
-
Shen, Chang (MSFC-EV43)