Limiting available memory to an NT app running on XP?
-
We have an application built for windows NT (no updates available from the vendor) back in those times where 512 MB of RAM was a lot. The app will run on windows XP, but only with systems with less than 2 Gigs of RAM (with the VM off) or systems with 1 Gig of ram and the VM set below the amount that in total adds to roughly 2 Gigs. What I think is happening is that the developer of the app does a query of the system's available ram on startup and stores it in a 32 bit int (2 billion, 73 million.... etc bytes), without an overflow check I guess. This is since when, I assume, the value of the variable is checked against a minimum amount of ram, it fails the test and the app throws an error message that not enough memory is available, when in fact there is plenty. This hypothesis is due to being able to run the app on systems with 1 Gig of Ram as mentioned above and the VM limited to not exceed 2 Gigs in total. So, that was my patch before, just set a max limit on the VM. But now we are getting systems with 3 Gigs of ram and I have this issue again now and not an easy of a fix. Even for the other systems that this works on, they are running into performance issues when multiple apps are open too, since we don't change the VM settings back to being system managed after using the app, as that is too inconvenient. . .limiting the VM hurts other apps used on the system. So, my question is, after not finding anything on a net search, does anyone know how I might force the application, in or via win XP to only be given a certain amount of memory?? I've looked into the compatibility features of XP but no setting is available for this. I've thought of having a huge image that the user would open to hog a bunch of ram as a fairly siimple hack, but haven't tried it. Perhaps the OS would just create a larger pagefile in that case anyway. Thoughts anyone? Thanks in advance.
-
We have an application built for windows NT (no updates available from the vendor) back in those times where 512 MB of RAM was a lot. The app will run on windows XP, but only with systems with less than 2 Gigs of RAM (with the VM off) or systems with 1 Gig of ram and the VM set below the amount that in total adds to roughly 2 Gigs. What I think is happening is that the developer of the app does a query of the system's available ram on startup and stores it in a 32 bit int (2 billion, 73 million.... etc bytes), without an overflow check I guess. This is since when, I assume, the value of the variable is checked against a minimum amount of ram, it fails the test and the app throws an error message that not enough memory is available, when in fact there is plenty. This hypothesis is due to being able to run the app on systems with 1 Gig of Ram as mentioned above and the VM limited to not exceed 2 Gigs in total. So, that was my patch before, just set a max limit on the VM. But now we are getting systems with 3 Gigs of ram and I have this issue again now and not an easy of a fix. Even for the other systems that this works on, they are running into performance issues when multiple apps are open too, since we don't change the VM settings back to being system managed after using the app, as that is too inconvenient. . .limiting the VM hurts other apps used on the system. So, my question is, after not finding anything on a net search, does anyone know how I might force the application, in or via win XP to only be given a certain amount of memory?? I've looked into the compatibility features of XP but no setting is available for this. I've thought of having a huge image that the user would open to hog a bunch of ram as a fairly siimple hack, but haven't tried it. Perhaps the OS would just create a larger pagefile in that case anyway. Thoughts anyone? Thanks in advance.
-
I don't have a system with XP64 to try. So, you can set the available memory to use on a 32 bit app when you launch it on XP64? How does 5GB equate to 1GB to the 32 bit app? I don't know exactly how a 32 bit app would run on a 64 bit OS, but thought the OS might just use half of the 64 bit address space or instruction or whatever. I could try the MAXMEM thing, didn't know about that, thanks. It would be a hassle as it would require a reboot before they used the app then a restart when they left the pc (plus a batch file or something to make the boot.ini file change), but it's a solution. The VM thing might be the best approach so far I guess. . .have to look into that more as if the VM could be launched on demand, the problematic app opened in it and used, then close when done, that would be slick. But, I bet there is more to that and as I said, I haven't played with VMs at all yet. Thanks, Kent
-
I don't have a system with XP64 to try. So, you can set the available memory to use on a 32 bit app when you launch it on XP64? How does 5GB equate to 1GB to the 32 bit app? I don't know exactly how a 32 bit app would run on a 64 bit OS, but thought the OS might just use half of the 64 bit address space or instruction or whatever. I could try the MAXMEM thing, didn't know about that, thanks. It would be a hassle as it would require a reboot before they used the app then a restart when they left the pc (plus a batch file or something to make the boot.ini file change), but it's a solution. The VM thing might be the best approach so far I guess. . .have to look into that more as if the VM could be launched on demand, the problematic app opened in it and used, then close when done, that would be slick. But, I bet there is more to that and as I said, I haven't played with VMs at all yet. Thanks, Kent
Create a DLL that is injected into that process. Determine which API the application is using to determine the memory size, hook that API for this application and fake the return value to that which makes it work correctly. This is essentially what any type of application compatibility setting would have done if none are avaialble.
8bc7c0ec02c0e404c0cc0680f7018827ebee
-
I don't have a system with XP64 to try. So, you can set the available memory to use on a 32 bit app when you launch it on XP64? How does 5GB equate to 1GB to the 32 bit app? I don't know exactly how a 32 bit app would run on a 64 bit OS, but thought the OS might just use half of the 64 bit address space or instruction or whatever. I could try the MAXMEM thing, didn't know about that, thanks. It would be a hassle as it would require a reboot before they used the app then a restart when they left the pc (plus a batch file or something to make the boot.ini file change), but it's a solution. The VM thing might be the best approach so far I guess. . .have to look into that more as if the VM could be launched on demand, the problematic app opened in it and used, then close when done, that would be slick. But, I bet there is more to that and as I said, I haven't played with VMs at all yet. Thanks, Kent
No, I we're just toying around with your hypothesis about a 32 bit Int. 32 bits make 4GB so the 2GB limit should then mean that we're dealing with a signed integer. That would turn negative at 2GB and start over from zero at 4GB. So 5GB would be read as 1GB, but I could be wrong of course. You won't need an extra batchfile to change the boot.ini, that functionality is built in, see here.[^] The rebooting hassle I have no solution for though.