Re: Kernel malloc/realloc?

From: Alexander Grigoriev (alegr_at_earthlink.net)
Date: 02/15/04


Date: Sat, 14 Feb 2004 19:52:23 -0800

This comment is a remnant of Windows 3.1 standard mode. And even then the
words about physical memory were wrong (these were related to GMEM_FIXED).

Win32 API makes no guarantees about memory physical address.

"Alex" <AlX@a> wrote in message news:Oi8rNa28DHA.488@TK2MSFTNGP12.phx.gbl...
> Do you even know the diffrence between a RTL function and a System API
> function?
>
> As it's been sed before, pointing to RTL source code to understand how
> **SYSTEM** APIs work is stupid.
>
> Sorry, if it's ofensive, but this is what it is
>
> MSDN Library April 2003:
> GlobalAlloc:
> GMEM_MOVEABLE:
> "Allocates movable memory. Memory blocks are never moved in physical
memory,
> but they can be moved within the default heap."
>
> **"never moved in physical memory"**
>
>
> "Tim Roberts" <timr@probo.com> wrote in message
> news:9c9r20dgm2d1drglccnmf30g73lj87r2u4@4ax.com...
> > "Alex" <AlX@a> wrote:
> > >
> > >"Tim Roberts" <timr@probo.com> wrote:
> > >
> > >> "Alex" <AlX@a> wrote:
> > >> >
> > >> >"Tim Roberts" <timr@probo.com> wrote:
> > >> >
> > >> >Isn't the same allgorithm behing the user mode reallocation (not
> > >necesarly
> > >> >realloc, i'm shure this thread has nothing to do with the acctual
> realloc
> > >> >function :P) which we all use in user mode apps?
> > >>
> > >> No. Both relloc in the C run-time library and
> LocalRealloc/GlobalRealloc
> > >> use the new/copy/free model.
> > >
> > >Is that a fact? Or a beleif?
> >
> > The source code for Microsoft's C run-time library is included with
Visual
> > C++. You can look it up. If there's empty space following the block,
it
> > just expands the block. Otherwise, it's new/copy/free.
> >
> > Think about it for a bit. Your page table magic will ONLY work if all
> heap
> > allocations are done in units of whole pages. As soon as you have two
> > objects in the same page, you can't alter the mapping without screwing
up
> > the other objects in the page. The C run-time malloc and the Win32 heap
> > alloc work in units of 32 bytes.
> >
> > >> in order to save page space. So, 80000000 has the DOS interrupt
> vectors
> > >> from physical address 0, 800C0000 has the VGA BIOS at physical
address
> > >> C0000, and so on.
> > >
> > >This mapping is documented behaviour? For what OS-es is it used?
> >
> > I've never seen it documented by Microsoft, but it's fact, and operating
> > system routines rely on it. I know it's true for the NT-based systems
> > (NT/2K/XP). It used to be true on Windows 3.1. I do not remember about
> > 95/98.
> > --
> > - Tim Roberts, timr@probo.com
> > Providenza & Boekelheide, Inc
>
>



Relevant Pages

  • Re: To Pin or Copy memory?
    ... I believe that depends on the number of times the win32 API is being called. ... Shell MegaPack: GUI Controls For Drop-In Windows Explorer like Shell ... Use the Marshal class to allocate native memory an copy the data ... I know that pinning will hinder the GC's efficiency. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Fast file access
    ... int Size); ... unsigned char* data; ... CreateFile and relatives are part of the Win32 API, ... I have tested the same with memory mapped files and the first access is ...
    (microsoft.public.pocketpc.developer)
  • Re: How to increase HEAP size in VC++ 6.0 environment
    ... Look at the Win32 API calls VirtualAlloc() and VirtualFree. ... or compiler dependent. ... > My program needs a lot of memory and after allocating some using NEW ...
    (comp.lang.cpp)
  • Re: Implementing a custom memory allocator
    ... more about Windows OS and the Win32 API to extend my knowledge about ... allocate its own memory range, and start allocating memory from it. ... save few CPU cycles, this improvement is just negligible, especially if ...
    (microsoft.public.win32.programmer.kernel)
  • Re: 64-bit G5?
    ... The Win32 API allows access to huge files in much the same way. ... API call takes two separate int32 args that consist of a low word and ... and painful segmented memory architecture would end up being in order. ... One Emacs to rule them all. ...
    (comp.lang.lisp)