Opened 9 years ago

Closed 9 years ago

#8683 closed Bugs (wontfix)

windows native shared memory freeze when no more ram available

Reported by: julien.potiron@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc:

Description

Hi,

I'm working with native windows shared memory and I have a problem when I'm running low on memory.

If I have only 512Mb of Ram available and I create a window_shared_memory object with a size of 1Gb, the creation works well. But when trying to write inside the shared memory, the computer freezes, waiting for memory to be freed.

Is there a way to avoid this freeze (I almost have to reboot my computer), or at least a way to throw an error when trying to write to memory we don't have ?

Thanks.

Change History (4)

comment:1 by anonymous, 9 years ago

Component: Noneinterprocess
Owner: set to Ion Gaztañaga

comment:2 by anonymous, 9 years ago

Just a precision (after reread it's not obvious), the freeze of the computer is probably because due to moving memory to swap (which is kind of normal).

The freeze I don't want is my program waiting for memory to be freed. I want to be able to have the same behavior than with other objects which is to throw a MemoryError exception when no more memory is available.

comment:3 by anonymous, 9 years ago

There is no way to detect your problem. When you use windows_shared_memory (and CreateFileMapping win32 API), you are reserving memory that is backed by RAM plus the pagefile. When you start writing to the shared memory region, that memory must be in RAM so other programs and data must go to the pagefile to free RAM for your write. I don't know of any notification mechanism in windows to detect this behavior.

You can try to map a portion of the file, write it and unmap it. Then you map a different portion. That could help windows to manage better the pagefile (as it only needs to care about the mapped region and not the whole shared memory object).

comment:4 by Ion Gaztañaga, 9 years ago

Resolution: wontfix
Status: newclosed

I'm closing this as there is no solution for systems trashing on low memory conditions. I'm sorry.

Note: See TracTickets for help on using tickets.