Mihran Hovsepyan
Mihran Hovsepyan

Reputation: 11108

Is managed_mapped_file able to increase file size due to allocation?

I want to work with memory mapped files using boost::interprocess::managed_mapped_file. But cannot find in the documentation details about memory allocation by it.

Namely I want to know does allocate() fail with boost::interprocess::bad_alloc error if all memory specified during creation of boost::interprocess::managed_mapped_file object (actually the size of the file) is already allocated or there is no enough big sequence of available memory or it just increases the size of the file.

If it fails, how can I make it to increase the size of the file (say increase two times)?

Upvotes: 0

Views: 821

Answers (1)

sehe
sehe

Reputation: 393239

You can grow a memory mapped file, but not while other processes have it mapped. All clients will normally have to remap the file.

Slightly related: boost::interprocess::managed_shared_memory: Grow(): Memory Reused?

Upvotes: 1

Related Questions