Results 1 to 5 of 5

Thread: Running MEMORY and MEMORY2 example scripts under WINDOWS 7 (64bit)

  1. #1

    Running MEMORY and MEMORY2 example scripts under WINDOWS 7 (64bit)

    Eros:

    I frequently use the API sample scripts MEMORY and MEMORY2 to monitor memory usage, and I just discovered when I run them on a WINDOWS 7 (64bit) system they are not reporting the correct total installed memory values. The system I noticed this on has 8GB of installed memory, however MEMORY and MEMORY2 report only 4GB of installed memory.

    Any idea what might be causing this difference?

    Don
    XPS 1710

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,779
    Rep Power
    10

    Re: Running MEMORY and MEMORY2 example scripts under WINDOWS 7 (64bit)

    Well, it is simply related to the fact that 32bit numbers (LONG and/or DWORD) have a range of:
    0 to 4294967295 for DWORD
    -2147483648 to 2147483647 for LONG
    http://www.thinbasic.com/public/prod...cvariables.htm
    thinBasic is still a 32bit application.
    We hope Power Basic will release soon a 64 bit version of their compiler so we will be able (hopefully) to release a 64 bit version of thinBasic.

    One of the advantages of 64bits OS is the amount of total memory they can address: http://msdn.microsoft.com/en-us/library/aa366778(VS.85).aspx

    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,779
    Rep Power
    10

    Re: Running MEMORY and MEMORY2 example scripts under WINDOWS 7 (64bit)

    I just checked and maybe we can use GlobalMemoryStatusEX API function:
    http://msdn.microsoft.com/en-us/library/aa366589(VS.85).aspx

    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,779
    Rep Power
    10

    Re: Running MEMORY and MEMORY2 example scripts under WINDOWS 7 (64bit)

    See if this piece of code works correctly:
    [code=thinbasic]
    '---Basic info about memory occupation

    Type MEMORYSTATUSEX
    dwLength As DWord
    dwMemoryLoad As DWord
    ullTotalPhys As Quad
    ullAvailPhys As Quad
    ullTotalPageFile As Quad
    ullAvailPageFile As Quad
    ullTotalVirtual As Quad
    ullAvailVirtual As Quad
    ullAvailExtendedVirtual As Quad
    End Type

    Declare Function GlobalMemoryStatusEx Lib "KERNEL32.DLL" Alias "GlobalMemoryStatusEx" (ByRef lpBuffer As MEMORYSTATUSEX) As Long

    Dim lpBuffer As MEMORYSTATUSEX

    '---Important: set UDT len
    lpBuffer.dwLength = SizeOf(lpBuffer)

    GlobalMemoryStatusEx (lpBuffer)

    msgBox 0, "Physical memory:"+ $CRLF + _
    "Available" + $TAB + Format$(lpBuffer.ullAvailPhys/1024/1024, "0")+" MB"+ $CRLF + _
    "Installed" + $TAB + Format$(lpBuffer.ullTotalPhys/1024/1024, "0")+" MB"+ $CRLF + _
    $CRLF + _
    ""
    [/code]
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #5

    Re: Running MEMORY and MEMORY2 example scripts under WINDOWS 7 (64bit)

    Eros:
    SUCCESS!!

    Works like a dream.

    Thanks

    Don
    XPS 1710

Similar Threads

  1. Windows 7, 64bit - no extension connection, no edit
    By Petr Schreiber in forum Installation
    Replies: 3
    Last Post: 04-09-2010, 12:42

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •