Re: Simple code doesn't work on two systems
- From: "Ben Voigt" <rbv@xxxxxxxxxxxxx>
- Date: Wed, 24 Jan 2007 17:23:17 -0600
"Sourcerer" <enlork@xxxxxxxxxxxxxx> wrote in message
news:ep8lmm$e8$1@xxxxxxxxxxxxxxxxx
"Nathan Mates" <nathan@xxxxxxxx> wrote in message
news:12rfknp31v72781@xxxxxxxxxxxxxxxxxxxxx
In article <ep8hdf$hc7$1@xxxxxxxxxxxxxx>,
Sourcerer <enlork@xxxxxxxxxxxxxx> wrote:
My question is, what does this have to do with Virtual Memory? I
want to occupy physical memory, not virtual.
So does everybody. But, when every app wants a lot of physical
memory, then something's gotta give. Virtual memory is the way of
fulfilling the promises made to each app, allowing them to share the
physical memory. Consider virtual memory the security for a loan
you're getting.
Something has to go wrong eventually, yes, but why is the program
terminated immediately?
Why doesn't the system allocate physical memory when it is available, and
only when it's running out go tamper with virtual memory?
Only kernel-mode code can use physical memory, all user code uses virtual
memory which can be mapped into physical memory or into the swapfile (also
called pagefile). You can't disable virtual memory, the VMM is essential to
any modern OS because it does stack allocation, process isolation, and a
host of other stuff that's not related to the swapfile. You can only
disable the swapfile. Some things can still be purged temporarily from
physical ram even without a swapfile, specifically read-only segments which
are mainly code (because the system can always get them back from disk).
That's one reason you can't delete a program that's running.
In fact, with 1.7GB of physical ram, you are as likely to run out of virtual
memory space (2 GB limit, which can be fragmented leaving holes, and even
though you haven't much fragmentation in your allocation pattern, the DLL
load addresses cause some holes in your address space) as physical.
Why the program terminates immediately I can't quite say. How do you know
it isn't running? On a fast processor it could finish before task manager
ever notices it. Perhaps if you write to a file at the beginning of the
program, you can find out if it ever starts up. You could also log after
each allocation to find out how many times the loop runs. Make sure you
flush the file after each write, otherwise the runtime library will cache
your messages in memory, and they'll be lost when the error occurs.
--
"It is easy in the world to live after the world's opinion; it easy in
solitude to live after our own; but the great man is he who in the midst
of the crowd keeps with perfect sweetness the independence of solitude."
Ralph Waldo Emerson, Self-reliance 1841
http://pinpoint.wordpress.com/
.
- References:
- Simple code doesn't work on two systems
- From: Sourcerer
- Re: Simple code doesn't work on two systems
- From: Sourcerer
- Re: Simple code doesn't work on two systems
- From: Willy Denoyette [MVP]
- Re: Simple code doesn't work on two systems
- From: Sourcerer
- Re: Simple code doesn't work on two systems
- From: Nathan Mates
- Re: Simple code doesn't work on two systems
- From: Sourcerer
- Simple code doesn't work on two systems
- Prev by Date: Re: Simple code doesn't work on two systems
- Next by Date: Re: Simple code doesn't work on two systems
- Previous by thread: Re: Simple code doesn't work on two systems
- Next by thread: Re: Simple code doesn't work on two systems
- Index(es):
Relevant Pages
|
Loading