What is the Memory Mapped File Class?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
trycatchthis
Earned a small fee
Earned a small fee
Posts: 14
Joined: Thu Apr 07, 2005 3:40 pm

What is the Memory Mapped File Class?

Post by trycatchthis »

I searched for such a class with no luck.
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

Hi!
Not sure what you want to do, but have a look at wxMemoryFSHandler.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
trycatchthis
Earned a small fee
Earned a small fee
Posts: 14
Joined: Thu Apr 07, 2005 3:40 pm

Post by trycatchthis »

You use memory mapped files so that instead of allocating a big chunck of ram you use a file.

They make a file look like if it was loded in ram.
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

Hi!
For that purpose try using wxMemoryFSHandler with a wxFile. There is no wxMemoryFile class as far as I remember.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
User avatar
Ryan Norton
wxWorld Domination!
wxWorld Domination!
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton »

upCASE wrote:Hi!
For that purpose try using wxMemoryFSHandler with a wxFile. There is no wxMemoryFile class as far as I remember.
Hey, I've got one for wikiserver I can put up if there's demand for it....
[Mostly retired moderator, still check in to clean up some stuff]
mjs
Experienced Solver
Experienced Solver
Posts: 93
Joined: Wed Feb 09, 2005 3:53 am
Contact:

Post by mjs »

It'd be nice if you could upload it. Until now I'm unsure if it's really useful because on 32 bit platforms you have an effective 2G limit which seems too restrictive for a file API ...

Regards,
Mark
trycatchthis
Earned a small fee
Earned a small fee
Posts: 14
Joined: Thu Apr 07, 2005 3:40 pm

Post by trycatchthis »

I dont know if wxMemoryFSHandler is what i am looking for.

Does it store the data in memory?
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

Well, I'll just quote the docs...
wxMemoryFSHandler::AddFile
Add file to list of files stored in memory. Stored data (bitmap, text or raw data) will be copied into private memory stream and available under name "memory:" + filename.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
User avatar
Ryan Norton
wxWorld Domination!
wxWorld Domination!
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton »

upCASE wrote:Well, I'll just quote the docs...
wxMemoryFSHandler::AddFile
Add file to list of files stored in memory. Stored data (bitmap, text or raw data) will be copied into private memory stream and available under name "memory:" + filename.
All a memory mapped file is using

CreateFileMapping
MapViewOfFile
UnmapViewOfFile
CloseHandle

on Win32

and mmap and munmap on POSIX (OSX I think too).
[Mostly retired moderator, still check in to clean up some stuff]
trycatchthis
Earned a small fee
Earned a small fee
Posts: 14
Joined: Thu Apr 07, 2005 3:40 pm

Post by trycatchthis »

can you define "private memory stream"
Post Reply