Re: realloc, copy and VM



Michael Wojcik wrote:
>
.... snip ...
>
> Take the typical case: the implementation uses a linear virtual
> address space for all allocated objects, and the contents of C object
> pointers are addresses as used by the virtual memory manager. If an
> object occupies the page at address n*pagesize, and you attempt to
> extend it with realloc, then:
>
> - There may be no page mapped at address (n+1)*pagesize, and the
> implementation could request that the VMM map a new page at that
> address. Aside from performing its internal housekeeping, the
> realloc is done; no copying needs to take place.
>
> - There may be a page mapped at address (n+1)*pagesize. If it's part
> of some other object, then obviously the implementation cannot steal
> that address for the object being resized, because pointers into the
> other object will refer to that portion of the virtual address space.
> The realloc'd object will have to be moved.

There are a lot of possibilities. My nmalloc for DJGPP, available
on my site, mallocs into a linear virtual memory map and trys to
handle all the various possibilities of adjacent free space. The
objective is to avoid memory copies, which it can do when expanding
into free space above. It also checks for free space below, which
may avoid having to assign a new larger junk (and possibly
failing). At any rate it is a simple model, yet has many possible
cases. Available at:

<http://cbfalconer.home.att.download/nmalloc.zip>

--
"I'm a war president. I make decisions here in the Oval Office
in foreign policy matters with war on my mind." - GWB 2004-2-8
"If I knew then what I know today, I would still have invaded
Iraq. It was the right decision" - G.W. Bush, 2004-08-02
"This notion that the United States is getting ready to attack
Iran is simply ridiculous. And having said that, all options
are on the table." - George W. Bush, Brussels, 2005-02-22


.



Relevant Pages

  • Re: Computer slow
    ... If the 30.5 GB is FREE space, your hard drive has plenty of free space. ... XP will expand your virtual memory. ... From the Start menu, select All programs, then select Accessories, then System Tools, and then System Information. ... MS-MVP Windows, Aumha.net VSOP, DTS-L ...
    (microsoft.public.windowsxp.newusers)
  • Re: virtual memory
    ... Neither relate to free space on the drive.. ... You will get warnings about 'virtual memory' when the free space on the hard ... MS-MVP Windows Shell/User ...
    (microsoft.public.windowsxp.perform_maintain)
  • RE: Virtual Memory too slow
    ... First check to be sure you have plenty of free space on your hard drive. ... check to be sure your virtual memory settings are correct. ... Click the Advanced tab under ... Managed Size" to let Windows set size it needs for optimum performance. ...
    (microsoft.public.windowsxp.help_and_support)
  • Shrinking and growing hard drive space ?
    ... the hour I am down to Kilobytes of free space, ... >What's your virtual memory settings at?You may have it ... settings are for them.(It should be 1.5 X your RAM memory) ... virtual memory click change--check circle next to system ...
    (microsoft.public.windowsxp.perform_maintain)