[Win32utils-devel] Need some help with latest win32-mmap

Johan Nilsson johan.nilsson at esrange.ssc.se
Wed Oct 11 03:13:03 EDT 2006


 

> -----Original Message-----
> From: win32utils-devel-bounces at rubyforge.org 
> [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of 
> Berger, Daniel
> Sent: den 10 oktober 2006 15:43
> To: Development and ideas for win32utils projects
> Subject: Re: [Win32utils-devel] Need some help with latest win32-mmap
> 
> > -----Original Message-----
> > From: win32utils-devel-bounces at rubyforge.org
> > [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of Johan 
> > Nilsson
> > Sent: Tuesday, October 10, 2006 12:51 AM
> > To: Development and ideas for win32utils projects
> > Subject: Re: [Win32utils-devel] Need some help with latest 
> win32-mmap

[snip]

> > I haven't checked the implementation and this is probably 
> too obvious 
> > to be the culprit, but:
> > 
> > If map1.rb runs to completion and closes the mmap before 
> map2.rb can 
> > attach by opening it, the memory map won't exist unless you 
> are using 
> > something else than the paging file as backing storage. The Win32 
> > mmaps are reference counted through their handles as pretty much 
> > everything else.
> > 
> > Also, as you can see it that using MMap.new from map2.rb 
> works as the 
> > first step, but as this only creates a new identically named mmap 
> > there is no 'test' data there. Hence the 'boom' I'd guess.
> > 
> > HTH,
> > 
> > Johan Nilsson
> 
> Yes, you and Heesob are both right.  I was thinking the value 
> stayed resident.  Once I stuck a sleep call in there and ran 
> it from a second terminal it worked fine.  Duh.
> 
> In other news, it looks like I need to set a default size for 
> MMap.open.
> What sounds reasonabl? 1k?

I haven't tried this myself, and judging from the MSDN docs it's also
not entirely clear that it will work, but: Try using zero(0) as the size
when calling MapViewOfFile, and then use VirtualQuery to retrieve the
size of the view.

If you want to persist the values, use a file as the backing store
(could be an optional feature, e.g. :name => '/path/to/filename' ).

Oh, and use the "Global\" prefix for map names if you intend to share
the data between different terminal server sessions (Win2k and upwards).
But I guess you already do that internally.

Regards / Johan


More information about the win32utils-devel mailing list