Re: Simple code doesn't work on two systems




"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/


.



Relevant Pages

  • Re: Reproducable Memory Leak using simple value types
    ... One button allocated memory, ... Clicking both buttons I got that VM allocation got to 100MB and after button ... Physical memory is GC'd correctly but the VM is dead forever. ... It seems that if an ARRAY is involved with VM allocation, ...
    (microsoft.public.dotnet.languages.csharp)
  • relic Have you learned how to post yet?
    ... As you have a selective memory, here is the source code for you. ... applications with a 4 GB virtual address space. ... that run on computers with more than 2 GB of physical memory. ... Address Windowing Extensions (AWE) enables applications to address more = ...
    (alt.os.windows-xp)
  • Re: Defrag drive ???
    ... Under Windows NT 4.0, a pagefile could be a fantastic garbage collector, ... with one allocation request, which means that clever allocation techniques ... Since the entire swapfile is created at once, ... memory' errors to anything asking for more memory. ...
    (comp.sys.mac.system)
  • Re: RAM
    ... For applications that are I/O-intensive, ... The 4GT RAM Tuning feature increases the memory ... more than 2 GB of physical memory. ... VirtualAlloc function. ...
    (alt.os.windows-xp)
  • Re: 4GB Physical Memory Support
    ... Whether or not 4GB of physical memory is necessary is a moot point, the question remains why changing the page file size altered the amount of physical memory recognized by Windows. ... However, keep in mind that the PCI Hole exists as a result of addressing done by the BIOS, not by Windows. ...
    (microsoft.public.windowsxp.hardware)

Loading