Announcement

Collapse
No announcement yet.

Memory/Swapping

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael Mattias
    replied
    When I went to memory-mapped files with absolute arrays to replace 'real' arrays, I got a HUGE reduction in the "Page Faults" number you see in the report..."Page Faults" is the counter of how many times the process requested memory which was currently swapped out and had to be swapped in.

    I think there is a thread here with a discusssion of that... let me look....yes, here is the OLD forum page, which should be readable..



    You can see the page faults ("swap-in required") for the same test file data went from 1.1 million to just under 37,000... which is not too shabby if you ask me.

    MCM

    Leave a comment:


  • Gert Voland
    replied
    Michael,

    OK, works fine, I will test the call at different levels of memory allocation in
    the project and then make a decision where to warn/inform the user.

    Yes, I wondered why it all came in lower case ... Normally that is not your
    style! I don't think anyone can expect you (or others) to re-post your (their)
    code. Of course that effect de-values those contributions quite a bit because
    not everyone is able to readily respond as you did just now.

    Eventually I will also consider your suggestion to store the array data in a
    disk file and memory-map it - after checking how often I get close to the
    limits of installed memory.

    Thanks again.

    Regards, Gert

    Leave a comment:


  • Michael Mattias
    replied
    That's what happened when the forum was converted: a lot of posts ended up getting converted to all lower-case letters.

    The token "getprocessmemoryinfo" should be "GetProcessMemoryInfo"

    "Too bad we can't edit the posts if more than 15 days old" (he said, having only yesterday contacted the PBPTB about same).

    Oh, well, Steve told me how to fix it, I have to send complete new text of the message to them and a 'forum adminstrator' can replace the post.

    Leave a comment:


  • Gert Voland
    replied
    Michael,

    thanks for that piece of code. It compiles and runs on PBCC V4.04.
    I get the following output:

    process memory statistics for process id 976 on 11-14-2007 at 16:36:32

    process memory statistics with array allocated
    can't get address for getprocessmemoryinfo

    process memory statistics with array de-allocated
    can't get address for getprocessmemoryinfo

    end of report


    The relevant variables are:

    szlibname = psapi.dll
    szprocname = getprocessmemoryinfo
    hlib = 1760755712
    dwaddr = 0

    Is this checking a none-existing process, or what am I doing wrong?

    Regards, Gert.

    Leave a comment:


  • Michael Mattias
    replied
    BTW, you might do better in the long run that instead of using REDIM PRESERVE, storing your array data in a disk file and memory-mapping it. Then just re-map your view of the file and 're' REDIM AT instead of REDIM PRESERVE.

    That way you are not doing constant re-allocation/de-allocation.

    Memory Mapped Files instead of RANDOM disk file access 5-8-04

    Leave a comment:


  • Michael Mattias
    replied
    This is your lucky day:
    Add Process Memory Usage Report to any program 1-12-04

    (It don't get no simpler than TWO lines of code, one of them an #INCLUDE).

    MCM

    Leave a comment:


  • Gert Voland
    started a topic Memory/Swapping

    Memory/Swapping

    Hi,

    in a project I dynamically adjust the memory usage by REDIM PRESERVE of
    some multi-dimensional arrays. The complexity increases up to 3^n, n being
    the number of user variables. Since the algorithms predict only an upper limit
    of needed memory, which is only reached sometimes, the adaptive REDIM has
    proven to be a good method.

    Now I wonder if there is a way to find/measure the momentary memory
    allocation compared to the maximum of available non-swapped memory?
    My goal would be to inform the user when swapping to disk starts
    (or has just started), then causing a considerable slow-down in execution.

    Does someone know a simple method for PBCC (+ Win32Api)?

    Regards, Gert.
Working...
X