Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Is it possible to use file mapping object instead of RAM in ANSI-C?

$
0
0

Hi, 

The problem is the following. We run our desktop application under Windows XP and Windows 7. We have not enough of RAM for our application and in our case it is not possible to extend RAM capacity. The point is, that in one algorithm in our application we allocate 500MB of RAM. 

So, we have 2 choices:

1) Optimize our algorithm for using a less amount of RAM - it can take some time. 

2) Or like a quick solution - just use file mapping object instead of RAM. 

Also I should say, that we can not use swap-file on our systems. We use only RAM. 

How we create this file mapping object. We create it with sequential calls of next functions:

CreateFile()

GetProcessWorkingSetSize()

SetProcessWorkingSetSize()

CreateFileMapping()

OpenFileMapping()

MapViewOfFile()

As a result we have structure, which is placed into this mapping file and file is opened. The point is, that pointer to this structure is always 0x00000000 and nothing works.

So, my question is, whether it is possible to create mapping file on the hard disk with size of 1GB for example instead of using RAM memory? And if possible, how to fix problem with initialization of structure pointer, which is placed inside of file mapping object memory and always equal 0x00000000? 

-- 

Kind regards,

Oleksii Kyslyi 



Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>