# Restrict memory usage of wine (ulimit)

## LiquidAcid

Hi there,

I have some problem with an application, when running it through wine. The problematic app is Shiny's Sacrifice (the demo). I wanted to test the app on a system for some issues it has with D3D. I don't own the system, so I can't change configuration.

The thing is that the system only has 512MB of physical memory, but a lot more swap. 8GB in total. That's also the problem for Sacrifice, which reports on startup that virtual memory is too low and therefore exits.

I searched the web and the problem is NOT wine related, but also appears on Windows if you're using a system with 4GB of RAM, 4GB of swap, anything that doesn't really fit anymore into a 32bit integer. The problem with Sacrifice originates from an integer overflow, but there is nothing I can do about that.

So I tried to use ulimit to restrict the amount of memory the app can use. That doesn't seem to work correctly. I'm currenly using the -v switch of ulimit, which restricts virtual memory. I have set this to 2GB (but also tried other values like 64MB, 128MB, 512MB, etc.). That does not work, wine doesn't even start:

user@yui09:~/.wine/drive_c/Program Files/Shiny/Sacrifice Demo$ wine "Sacrifice.exe" 

preloader: Warning: failed to reserve range 00000000-60000000

wine: failed to initialize: /homes/user/local//lib/wine/ntdll.dll.so: failed to map segment from shared object: Cannot allocate memory

Am I missing something here or do I need to also set other limit options for the needed effect?

Thanks,

liquid

----------

## aronparsons

The limit is working, but WINE is trying to allocate more memory than the limit allows and thus the syscall fails.  I don't know the solution to this right now, but perhaps there is a WINE configuration option to limit the amount of memory it uses since it doesn't seem to respect the limits?

----------

