473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Creating Smaller Memory-Mapped Views on a Huge 2G+ File

Good afternoon, I have written a C++ class for Windows and Linux that creates a memory-mapped view for an file of arbitrary size n. The code for the class constructor is in the www.pastebin.com url shown below.
I am currently testing the code on Windows 32 bit XP.
I have found for file sizes 0 < n <= 1.7GB , the constructor returns a valid pointer to a memory-mapped view. However, for a file size >= 2 GB, MapViewOfFile returns a NULL value and an error code of 8,"Not enough storage is available to process this command". Evidently, Windows cannot find an available address space of size 2 GB in the process.
Therefore, I may need to modify the class constructor to create a set of smaller memory-mapped views totaling >= 2GB bytes && < 2 ^ 32 - 1 bytes. The other requirement is to create a mapping between each of the smaller memory-mapped views and a randomly accessed address in the process' address space.
Previously, I used the following code for random access:
char* KeyArray;

try {
mmapFile = new cMemoryMappedFile(n);
}
catch (cException e)
{
throw;
}

KeyArray = (char *)(mmapFile->GetPointer());
KeyArray[i] = ...


How should I modify the class to handle these requirements? Thank you.

<iframe src="http://pastebin.com/embed_iframe.php?i=2GX0XHsm" style="border:none;width:100%"></iframe>
Feb 24 '11 #1
3 2605
Rabbit
12,516 Expert Mod 8TB
In 32 bit Windows, you can't go over 2 gigs. You have to use 64 bit if you want to address memory over 2 gigs.
Feb 24 '11 #2
Actually just under 4GB is the maximum size.
Feb 24 '11 #3
Rabbit
12,516 Expert Mod 8TB
You're right, my bad. I knew it yet I posted without thinking about it.
Feb 24 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Gregory | last post by:
Hello, I've managed to build two web pages, one that can display images with associated text data in a table, and one that can resize and display images without the text. I'd like to resize the...
1
by: cs | last post by:
In java I ahve the following code g.drawImage(this.createImage(new MemoryImageSource(r.width, r.height, this.colormap, backstore, r.y*this.width+r.x, this.width)), r.x, r.y, null); where...
6
by: Michael Isaacs | last post by:
Regarding use of enum's, I am wondering what the cost of memory is when creating the enumeration on the calling side, and then using it on the function/method side. See example below. If I...
3
by: Jeff | last post by:
I've been working on an application for a while now that has been giving me some trouble when it comes to working with a picturebox and memory usage. My company deals with digital imaging, so we...
5
by: NewToCPP | last post by:
Is there any way I can check the size of the Memory allocated by "new"?
7
by: Brano | last post by:
Hi all, I have a VB.NET Dll that is invoked via BizTalk 2002 AIC over Http protocol. the Dll is making a connection using a 3rd party connector to a Unidata database (old legacy stuff) All I...
6
by: Dan | last post by:
I'm using python's xml.dom.minidom module to generate xml files, and I'm running into memory problems. The xml files I'm trying to create are relatively flat, with one root node which may have...
14
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
12
by: NVergunst | last post by:
hello. First off, I am very new to dll coding (meaning tonight) and I need to be able to share a List<bool> and a List<double> between my main application and other applications that can interface...
1
by: z1 | last post by:
hi- i wrote a program with java using eclipse and i think i remember it used 70,000k in the process list in windows in task manager. i understand that there is some eclipse runtime overhead...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.