Click here to Skip to main content
15,924,679 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Specifying debugger Pin
Anders Molin25-Mar-03 13:21
professionalAnders Molin25-Mar-03 13:21 
GeneralRe: Specifying debugger Pin
Jon Sagara25-Mar-03 13:23
Jon Sagara25-Mar-03 13:23 
Generalcout << flush not working in my class that inherits from fstream Pin
mflores8825-Mar-03 10:28
mflores8825-Mar-03 10:28 
GeneralRe: cout << flush not working in my class that inherits from fstream Pin
Dave Bryant25-Mar-03 11:12
Dave Bryant25-Mar-03 11:12 
GeneralRe: cout << flush not working in my class that inherits from fstream Pin
mflores8826-Mar-03 5:15
mflores8826-Mar-03 5:15 
GeneralPbm with CDhtmlDialog Pin
RaajaOfSelf25-Mar-03 9:14
RaajaOfSelf25-Mar-03 9:14 
GeneralRe: Pbm with CDhtmlDialog Pin
RaajaOfSelf25-Mar-03 9:25
RaajaOfSelf25-Mar-03 9:25 
GeneralShared Memory Allocator for vc++ / Win32 Pin
CLM25-Mar-03 8:29
CLM25-Mar-03 8:29 
Hi all --

I want to create a shared memory allocator for STL containers, similar to the design employed in a recent issue of CUG, which had an article on doing such in Linux: http://www.cuj.com/current/?topic=current

In this article, a Factory pattern is used to construct an *entire* STL container in shared memory, which is exactly what I want to do, but I suspect the solution in this article is flawed. (If anyone has read this article I'd be curious to know if you came to the same conclusion.)

The reason it's flawed is because there is a tacit assumption that the virtual memory address returned by 'shmat' (roughly, the linux equivalent of the Win32 MapViewOfFile API) is the same across diff't processes.

I actually have no idea how safe this assumption is in Linux, but I know in Windows NT 4.0 that MapViewOfFile does tend to return the same address across processes for a given requested size when the WinNT paging file is used to back the virtual memory. But NT cannot guarantee this is true; therefore I cannot use MapViewOfFile. MapViewOfFileEx, on the other hand, lets the calling process request a particular starting virtual address, but if the process has already allocated any addresses in that range the call fails and returns 0, so this is not much better than MapViewOfFile as far as I can tell.

So my question is about the predictability of MapViewOfFileEx: who has experience with this (specifying a particular area in virtual memory)? How often and under what conditions does MapViewOfFileEx fail? I'm worried that relying on it would lead to an unreliable shared memory allocator, and yet I have no idea how often in practice people actually use this. Any thoughts, guidance here?

Many thanks,

Chris
GeneralRe: Shared Memory Allocator for vc++ / Win32 Pin
Neville Franks25-Mar-03 10:01
Neville Franks25-Mar-03 10:01 
GeneralRe: Shared Memory Allocator for vc++ / Win32 Pin
CLM25-Mar-03 12:03
CLM25-Mar-03 12:03 
GeneralRe: Shared Memory Allocator for vc++ / Win32 Pin
Neville Franks26-Mar-03 0:45
Neville Franks26-Mar-03 0:45 
GeneralRe: Shared Memory Allocator for vc++ / Win32 Pin
CLM26-Mar-03 15:56
CLM26-Mar-03 15:56 
QuestionHow to get pointer of outer class inside an inner class Pin
Anonymous25-Mar-03 8:17
Anonymous25-Mar-03 8:17 
AnswerRe: How to get pointer of outer class inside an inner class Pin
Tim Smith25-Mar-03 8:21
Tim Smith25-Mar-03 8:21 
GeneralRe: How to get pointer of outer class inside an inner class Pin
Anonymous25-Mar-03 8:31
Anonymous25-Mar-03 8:31 
GeneralRe: How to get pointer of outer class inside an inner class Pin
Tim Smith25-Mar-03 8:48
Tim Smith25-Mar-03 8:48 
QuestionHow to copy a large amount of data? Pin
Jakob Bysewski25-Mar-03 8:08
Jakob Bysewski25-Mar-03 8:08 
AnswerRe: How to copy a large amount of data? Pin
Tim Smith25-Mar-03 8:19
Tim Smith25-Mar-03 8:19 
GeneralRe: How to copy a large amount of data? Pin
Jakob Bysewski25-Mar-03 8:26
Jakob Bysewski25-Mar-03 8:26 
GeneralRe: How to copy a large amount of data? Pin
Tim Smith25-Mar-03 8:50
Tim Smith25-Mar-03 8:50 
GeneralRe: How to copy a large amount of data? Pin
Jakob Bysewski25-Mar-03 9:33
Jakob Bysewski25-Mar-03 9:33 
AnswerRe: How to copy a large amount of data? Pin
Daniel Turini25-Mar-03 8:45
Daniel Turini25-Mar-03 8:45 
GeneralPosition of items in a CListCtrl Pin
Kuniva25-Mar-03 8:07
Kuniva25-Mar-03 8:07 
QuestionHow to implement OpenGL in MDI? Pin
uNsignedINT25-Mar-03 7:45
uNsignedINT25-Mar-03 7:45 
GeneralNew Document MDI Pin
rahulv25-Mar-03 5:43
rahulv25-Mar-03 5:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.