[MUD-Dev] Re: TECH: Distributed Muds
derek at idirect.com
Thu Apr 26 21:52:23 New Zealand Standard Time 2001
>From Ola Fosheim Grostad:
> Derek Snider wrote:
>> When you have a UNIX server paging out idle memory pages, the only
>> way to keep pages in memory is to access them regularily, and the
>> only way to do that is to have a regular periodic traversal of all
>> objects in memory.
> You could lock them?
True... you could use the POSIX function mlock().
I still don't think periodic traversal is a bad thing... at least this
way you know that the memory has not become corrupt.
Also, in the case of a memory leak, leaked memory would be paged out.
> I certainly don't agree that paging should be turned off, why would
> you risk a core dump over a few milliseconds delay?
If something went crazy and started allocated memory like mad, your
program would coredump quickly instead of freezing for a minutes or
two until all virtual memory is exhausted.
As I said... better to have enough RAM than to rely on virtual memory.
Also... your program should check the return status of malloc(). If
malloc fails, then something bad is going on, and it should fail
gracefully... not coredump.
> Anyone know how to force a page to memory without accessing it?
> (Like what you would do in order to avoid CPU cache misses) Could be
> handy when you know that you are going to a certain set of pages,
> real soon...
If you're stuck on using virtual memory, you can use the mmap() family
MUD-Dev mailing list
MUD-Dev at kanga.nu
More information about the MUD-Dev