ssolie wrote:jaokim wrote:This sounds a bit scary. It sounds as though unlocked memory can, at random, be made inaccessible for my program....
Don't worry about it. Just use unlocked memory unless you are toying with DMA drivers or other situations which obviously require locked memory.
Yes,
I get it now. Sorry for nagging about it, but what I mean is that the term "somehow made inaccesible" is very unclear.
Imagine an unexperienced Amiga developer trying to find out why some memory access fails (for whatever reason, unrelated to unlocked memory). Without knowing much of AmigaOS's internals, and only from the wiki understanding that 1) some memory is locked by default, and 2) unlocked memory can "somehow be made inaccessible". It wouldn't be very unlikely, for the unexperienced developer to lock the memory "just to be sure that it isn't somehow made inaccessible -- its done default sometimes, how bad can it be?".
Both the "somehow made inaccessible" and "Use this function wisely" sentences tells the unexperienced developer nothing. Developing a device driver requires experience and anyone doing this will probably read the docs/wiki thoroughly and have some idea of what they're doing, whereas the casual developer might only read certain parts.
I'd suggest changing it to:
The LockMem() function is used to explicitly lock a memory block. This function will make sure your memory block is not unmapped or swapped out. If there is no good reason to lock memory then do not do it. It will prevent the memory system from optimizing memory layout and may lead to poor performance. This function is only of use when writing device drivers or other situations where locked memory is required.
This will give the LockMem-function a sense of more danger, rather than to be used as a safety precaution.