Physical memory in Win98

[b][red]This message was edited by Chas at 2003-5-22 11:14:40[/red][/b][hr]
Hi all!
Does anybody know which API functions should be used to get amount of physical memory used by the process in Win98?
Thanks in advance.


«1

Comments

  • : Hi all!
    : Does anybody know what API functions should be used to get amount of physical memory used by the process in Win98?
    : Thanks in advance.
    :
    [blue]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp[/blue]
  • : : Hi all!
    : : Does anybody know what API functions should be used to get amount of physical memory used by the process in Win98?
    : : Thanks in advance.
    : :
    : [blue]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp[/blue]
    :

    Using GlobalMemoryStatus I can get total amount of virtual but not physical memory used by process in Win98.
  • [b][red]This message was edited by adrianxw at 2003-5-22 11:40:26[/red][/b][hr]
    : : : Hi all!
    : : : Does anybody know what API functions should be used to get amount of physical memory used by the process in Win98?
    : : : Thanks in advance.
    : : :
    : : [blue]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp[/blue]
    : :
    :
    : Using GlobalMemoryStatus I can get total amount of virtual but not physical memory used by process in Win98.
    :

    Since the amount of physical memory used is variable, the value would be meaningless. Virtual memory is swapped into and out of physical memory as required by your process, and the other processes running on the system at the same time.

    Consider, your process could be using more virtual memory than actually phyiscally exists in your machine.

    Med venlig hilsen,

    Adrian...



  • : : : Hi all!
    : : : Does anybody know what API functions should be used to get amount of physical memory used by the process in Win98?
    : : : Thanks in advance.
    : : :
    : : [blue]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp[/blue]
    : :
    :
    : Using GlobalMemoryStatus I can get total amount of virtual but not physical memory used by process in Win98.
    :
    [blue]Just out of curiosity: what exactly wre you trying to achieve? Why do you need to know that amount? I can't think of a reason how it can be of use.[/blue]
  • SephirothSephiroth Fayetteville, NC, USA
    : [blue]Just out of curiosity: what exactly wre you trying to achieve? Why do you need to know that amount? I can't think of a reason how it can be of use.[/blue]
    :
    Silly Asm! That can be used in gaming to a huge advantage. Find out the max memory free, and after the map and player data has loaded, cache all the graphic and sound effects up to that limit to improve frames, lower drive-access, and make it run better.

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • [b][red]This message was edited by Chas at 2003-5-22 14:8:27[/red][/b][hr]
    : : : : Hi all!
    : : : : Does anybody know what API functions should be used to get amount of physical memory used by the process in Win98?
    : : : : Thanks in advance.
    : : : :
    : : : [blue]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp[/blue]
    : : :
    : :
    : : Using GlobalMemoryStatus I can get total amount of virtual but not physical memory used by process in Win98.
    : :
    : [blue]Just out of curiosity: what exactly wre you trying to achieve? Why do you need to know that amount? I can't think of a reason how it can be of use.[/blue]
    :

    I'm not going to use it. I just need to observe it, to control the changes in amount of physical memory of the running process.


  • : [b][red]This message was edited by Chas at 2003-5-22 14:8:27[/red][/b][hr]
    : : : : : Hi all!
    : : : : : Does anybody know what API functions should be used to get amount of physical memory used by the process in Win98?
    : : : : : Thanks in advance.
    : : : : :
    : : : : [blue]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp[/blue]
    : : : :
    : : :
    : : : Using GlobalMemoryStatus I can get total amount of virtual but not physical memory used by process in Win98.
    : : :
    : : [blue]Just out of curiosity: what exactly wre you trying to achieve? Why do you need to know that amount? I can't think of a reason how it can be of use.[/blue]
    : :
    :
    : I'm not going to use it. I just need to observe it, to control the changes in amount of physical memory of the running process.
    :
    :
    :



    (Um...) Something like this perhapps?[code]#include

    #define Kb 1024
    #define Mb 1048576
    char MemBuf[1042];
    void GetMemory()
    {
    MEMORYSTATUS stat;
    GlobalMemoryStatus (&stat);
    sprintf(MemBuf,
    "Total Physical Memory: %ld Kb
    Avail Physical Memory: %ld Kb
    Total Virtual Memory: %ld Mb
    Avail Virtual Memory: %ld Mb
    Total PageFile Size: %ld Mb
    Avail PageFile Size: %ld Mb",
    stat.dwTotalPhys/Kb,
    stat.dwAvailPhys/Kb,
    stat.dwTotalVirtual/Mb,
    stat.dwAvailVirtual/Mb,
    stat.dwTotalPageFile/Mb,
    stat.dwAvailPageFile/Mb);
    }[/code]

    I used that in a SysInfo app I was playing with a while back

    Stoic Joker
  • [blue]From that link:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp

    Quote:
    [italic]"...The GlobalMemoryStatus function obtains information about the [b]system's[/b] current usage of both physical and virtual memory..."[/italic]

    The function retrieves information about a system, and the question was about the process.[/blue]
  • : : [blue]Just out of curiosity: what exactly wre you trying to achieve? Why do you need to know that amount? I can't think of a reason how it can be of use.[/blue]
    : :
    : Silly Asm! That can be used in gaming to a huge advantage. Find out the max memory free, and after the map and player data has loaded, cache all the graphic and sound effects up to that limit to improve frames, lower drive-access, and make it run better.
    :
    : -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
    :
    :
    [blue]He-he! Good one, Seph!

    But you should not forget that you are in Windows and you have physical memory mapped for a lot of programs as VIRTUAL memory! If you overload your application with not always needed memory - you get some slowdown, because of page faults and memory swapping...

    Good point, you have to cache what's needed, but be careful, though. You might not leave a lot for a system to work with.
    [/blue]
  • : [b][red]This message was edited by Chas at 2003-5-22 14:8:27[/red][/b][hr]
    : : : : : Hi all!
    : : : : : Does anybody know what API functions should be used to get amount of physical memory used by the process in Win98?
    : : : : : Thanks in advance.
    : : : : :
    : : : : [blue]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp[/blue]
    : : : :
    : : :
    : : : Using GlobalMemoryStatus I can get total amount of virtual but not physical memory used by process in Win98.
    : : :
    : : [blue]Just out of curiosity: what exactly wre you trying to achieve? Why do you need to know that amount? I can't think of a reason how it can be of use.[/blue]
    : :
    :
    : I'm not going to use it. I just need to observe it, to control the changes in amount of physical memory of the running process.
    :
    :
    :
    [blue]You, maybe, can observe it, but to control it - just by your good coding practice. You can get some info here:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/memory_management_functions.asp

    See:
    GetProcessHeaps()
    HeapQueryInformation()

    But, again, these APIs is not for Win9x, but higher systems.
    The only way to see how much memory application uses in Win9x is to code your own [italic]malloc()[/italic]/[italic]free()[/italic] and [italic]operator new()[/italic] and implement a counter internally.

    If your application was coded by someone else - it will be really hard. You can download, maybe, some task manager for Win9x and see the memory usage there, but it is done using the undocumented Win9x knowledge. Scan, by the way, GOOGLE ("Windows Secrets") for that features, maybe you will find some.[/blue]
  • : : [b][red]This message was edited by Chas at 2003-5-22 14:8:27[/red][/b][hr]
    : : : : : : Hi all!
    : : : : : : Does anybody know what API functions should be used to get amount of physical memory used by the process in Win98?
    : : : : : : Thanks in advance.
    : : : : : :
    : : : : : [blue]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp[/blue]
    : : : : :
    : : : :
    : : : : Using GlobalMemoryStatus I can get total amount of virtual but not physical memory used by process in Win98.
    : : : :
    : : : [blue]Just out of curiosity: what exactly wre you trying to achieve? Why do you need to know that amount? I can't think of a reason how it can be of use.[/blue]
    : : :
    : :
    : : I'm not going to use it. I just need to observe it, to control the changes in amount of physical memory of the running process.
    : :
    : :
    : :
    : [blue]You, maybe, can observe it, but to control it - just by your good coding practice. You can get some info here:
    :
    : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/memory_management_functions.asp
    :
    : See:
    : GetProcessHeaps()
    : HeapQueryInformation()
    :
    : But, again, these APIs is not for Win9x, but higher systems.
    : The only way to see how much memory application uses in Win9x is to code your own [italic]malloc()[/italic]/[italic]free()[/italic] and [italic]operator new()[/italic] and implement a counter internally.
    :
    : If your application was coded by someone else - it will be really hard. You can download, maybe, some task manager for Win9x and see the memory usage there, but it is done using the undocumented Win9x knowledge. Scan, by the way, GOOGLE ("Windows Secrets") for that features, maybe you will find some.[/blue]
    :

    Surely...

    >>>
    The only way to see how much memory application uses in Win9x is to code your own malloc()/free() and operator new() and implement a counter internally.
    <<<

    ... that would, again, only show virtual memory since you do not know which pages you have allocated are swapped in and vice versa . You could, for example, allocate more memory than physically exists.

    Med venlig hilsen,

    Adrian...

  • SephirothSephiroth Fayetteville, NC, USA
    : [blue]He-he! Good one, Seph!
    :
    : But you should not forget that you are in Windows and you have physical memory mapped for a lot of programs as VIRTUAL memory! If you overload your application with not always needed memory - you get some slowdown, because of page faults and memory swapping...
    :
    : Good point, you have to cache what's needed, but be careful, though. You might not leave a lot for a system to work with.
    : [/blue]
    :
    Exactly. What I plan on doing with AoY Online is like what Epic has done with the Unreal Engine. You can setup how much memory it uses for caching extra textures, sounds, and such. The rule of thumb with this is to set it to 3/4 your total memory if you have more than 384mb of ram, or to set it to half your total memory if you have less. This ensures that you have plenty of ram for Windoze, while reserving a BUNCH for the game. Default value is 8mb, haha!

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • [green]Partly true. If you're willing to pay, you could have someone write a device driver to get that info for you! Like me perhaps ? lol[/green]
    [hr][red]~Bikram[/red]

  • SephirothSephiroth Fayetteville, NC, USA
    : [green]Partly true. If you're willing to pay, you could have someone write a device driver to get that info for you! Like me perhaps ? lol[/green]
    : [hr][red]~Bikram[/red]
    :
    :
    Oh oh oh! If you're gonna' pay I'll do it somehow! I'm sure I could fake it and make it seem decent... :p!
    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • : [b][red]This message was edited by Chas at 2003-5-22 11:14:40[/red][/b][hr]
    : Hi all!
    : Does anybody know which API functions should be used to get amount of physical memory used by the process in Win98?
    : Thanks in advance.
    :
    :
    :


    [CODE]
    // First declare a MEMORYSTATUS structure
    MEMORYSTATUS mem;

    // Second, obtain the current state of both virtual and physical memory
    GlobalMemoryStatus( &mem );

    // The amount of available physical memory is now stored in "mem.dwAvailPhys"
    DWORD dwMemNow = mem.dwAvailPhys;
    [/CODE]
    [GREEN]The total amount of physical memory is stored in mem.dwTotalPhys if you need it, btw :)[/GREEN]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories