Swap File?

Hi, quick question about virtual memory under QNX…

Does QNX use a swap file? Various places seem to suggest that it doesn’t:

e.g
http://www.openqnx.com/index.php?name=PNphpBB2&file=viewtopic&p=25054
http://www.itk.ntnu.no/fag/TTK4147/forelesninger/foiler/qnx63_rtos1.pdf

However I’ve been running some simple tests on the virtual memory system under QNX and was able to allocate up to 1.5 GB of memory to a single process (using mallocs) on a system which had only 1 GB of physical memory. I don’t see how this would be possible without using a swap file.

Cheers,
Matt

There is no swap file. Something is wrong in your test program.

Be careful when you read the documentation. QNX does use Virtual memory. It does page memory to disk. Memory references are virtual because the connection between your virtual references and the “Real” memory are made by page tables, segment tables, via the processor.

I recall that QNX may not allocate all the real memory to the stack initially, but instead allocate it as you get faults, but you should never be able to allocate more memory than the system has in real.

Mitchell probably meant to say that … “It does NOT page memory to disk”.

Ken, that’s right, sorry.

page memory to disk is actually somewhat true because you can memory map a file. However memory doesn’t get to be swapped with a page file ;-)

When you memory map a file, doesn’t it all get loaded into memory? Or does it get loaded on demand? I thought it was the former.

Hi guys,
Thanks a lot for your replies, they were most helpful.
Turns out the test program was fine, the machine had 2GB of ram after all!
Stupid me. :blush:
Cheers,
Matt