Deniil wrote:I just made a very simple CLI tool to test memory allocations using MEMF_VIRTUAL.
Deniil wrote:Some initial tests shows that swapping simply doesn't work.
Deniil wrote:Looks like even a plain and simple out-of-memory is not even handled properly but causes a problems.
Deniil wrote: Would a too large SWAP partition cause instant death?
Thomas Frieden wrote:Linux "solves" this by killing off random processes and re-using their memory.
Why MEMF_VIRTUAL ? Have you actually checked the autodocs ? If yes, where does it even mention MEMF_VIRTUAL ?
MEMF_VIRTUAL is NOT for memory allocations. Use either MEMF_SHARED or MEMF_PRIVATE. Using MEMF_VIRTUAL will make use of the default memory type MEMF_SHARED.
And there's your problem. MEMF_SHARED allocates memory that is automatically locked in memory. This can NOT be paged out. In other words, you basically fill the whole memory and lock it in place. Yes, this will lead to a lockup at one point because there simply is no way to page anything in or out if all memory ends up being locked.
On AmigaOS 3.9 and earlier you had to allocate e.g. Messages and Message Ports in public memory; this is no longer needed under AmigaOS 4.0 instead use the MEMF_SHARED flag. The MEMF_SHARED flag shares a lot of the properties that its public counterpart has, but is much more friendly to the system. Most notably, MEMF_SHARED memory
1. is unlimited in size as far as address space and swap space is sufficient
2. can be read by all tasks in the system, but doesn't have too many strings attached
3. can be locked by a special API call to keep in from being swapped out
The only place where MEMF_PUBLIC should be used if when your memory needs to be accessible by an interrupt. In all other cases use MEMF_SHARED. If you are allocating private data, like storage for strings or other data, use MEMF_ANY or MEMF_PRIVATE. This makes your memory inaccessible from other tasks, which is currently not enforced but will be so in the future.
MEMF_SHARED allocates memory that is automatically locked in memory. This can NOT be paged out.
Users browsing this forum: No registered users and 3 guests