Project

General

Profile

Actions

Emulator Issues #5625

closed

On Linux, 784 MB free memory is required to start emulation

Added by plbl4ster about 12 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

When running on Linux, Dolphin requires 784 MB RAM+swap available to start emulation. (No such requirement when running on Windows.) To fix it, in Source/Core/Common/Src/MemArena.cpp in Find4GBBase I changed from:

void* base = mmap(0, 0x31000000, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_SHARED, -1, 0);

to:

void* base = mmap(0, 0x31000000, PROT_NONE,
MAP_ANON | MAP_PRIVATE, -1, 0);

Some explanation. When mmap is used with PROT_NONE and MAP_PRIVATE it does not count as overcommit (source: http://www.kernel.org/doc/Documentation/vm/overcommit-accounting ). This is how Wine translates the Windows call to VirtualAlloc in Dolphin (I've checked using strace). See also this post on PCSX2 forum: http://forums.pcsx2.net/Thread-blog-VirtualAlloc-on-Linux

As the memory is unmapped immediately, I understand that mmap is only called for its return value and not any side effects? On my system it always returns an address from the same range, before and after making this modification. Anyway, I don't have enough knowledge on this topic to say with certainty that this change won't break anything, I can only say that it works for me.

Actions

Also available in: Atom PDF