Memory usage question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jenea Ciur

    Memory usage question

    Hi !
    If I will make

    char* pHugeMemory = (char*)malloc( huge_number_of_ bytes );

    in some place of my program, and after some time my program will jump
    to other processing place, that won't reference pHugeMemory location,
    then if physical memory storage is full, I suppose Windows, will
    discard lots of RAM memory pages to some swap place on my Hard Disk
    drive... right ?
    Now, if after some time I will refernce pHugeMemory, for reading, for
    example, then Windows will discard ( may be ) , something else and for
    sure will load all pHugeMemory back to physical memory.
    Now Question:

    Is there some win32 functions that could make me aware when my program
    references pHugeMemory memory location ? I mean to make me aware of
    when someone tries to read or write that location ?

    More exactly :
    that memory allocation is one XXX.DLL ( that is : allocated in
    function exported from DLL ) that is shared among more then one
    process.
    I would like to make aware all other processes ( that have loaded
    XXX.DLL ) when one process tries to read/write any located memory (
    pHugeMemory ) from a function exported from that XXX.DLL.

    Any suggenstions are welcome.
    Thank you in advance.

    PS:
    I that don't make sense I will more accurate next time ;)

  • Bruno van Dooren [MVP VC++]

    #2
    Re: Memory usage question

    More exactly :
    that memory allocation is one XXX.DLL ( that is : allocated in
    function exported from DLL ) that is shared among more then one
    process.
    Unless that memory is shared memory (which it isn't, from your description)
    each process has its own memory allocation in its own memory context.

    The fact that you allocate it inside the dll does not make it shared memory.
    See here for an explanation of how to use shared memory on windows.


    --

    Kind regards,
    Bruno van Dooren
    bruno_nos_pam_v an_dooren@hotma il.com
    Remove only "_nos_pam"


    Comment

    Working...