#196 freeze with incorrect maximum memory limit

v2.5x
closed-fixed
Ian Brabham
Internals (76)
5
2008-07-22
2008-06-28
Cory Nelson
No

Affects:
ScriptEnvironment::ScriptEnvironment()
ScriptEnvironment::SetMemoryMax()
maybe more, haven't checked entire codebase.

Cause:
Avisynth uses GlobalMemoryStatus to determine the maximum amount it can allocate. This is incorrect - GlobalMemoryStatus returns the memory available to the *system*, not to applications. If you have 4GiB of RAM, it will return 4GiB, and a 32-bit process can only allocate 2GiB max.

Effect:
I've got 8GiB of RAM on a 64-bit system - this causes avisynth to set the maximum memory too high and it eventually freezes up once it's done eating around 2GB of memory.

Fix:
Avisynth should use GetSystemInfo, and use ((intptr_t)lpMaximumApplicationAddress - (intptr_t)lpMinimumApplicationAddress) to determine the maximum amount of memory the process can allocate. However note that this is still only maximum address space - fragmentation and any other use of memory will take from this.

Workaround for users:
Use SetMemoryMax(1024) or lower on all your scripts.

Discussion

  • Ian Brabham
    Ian Brabham
    2008-07-03

    Logged In: YES
    user_id=673887
    Originator: NO

    Yep it's not quite right. I'll look into it.

     
  • Ian Brabham
    Ian Brabham
    2008-07-03

    • labels: --> Internals
    • assigned_to: nobody --> ianb1957
    • status: open --> open-accepted
     
  • Ian Brabham
    Ian Brabham
    2008-07-07

    • status: open-accepted --> pending-fixed
     
  • Logged In: NO

    Bit of a hackish fix, but it works :D

     
    • status: pending-fixed --> closed-fixed
     
  • Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).