Mail Archives: djgpp/1997/03/06/14:12:05
>If the problem that bugs you is that the _CRT0_FLAG_LOCK_MEMORY is not
>tested by the startup code, then I suggest that you change the startup
>code so it does ensure memory is locked. The sources are available
>and people who wrote it are still around and may be reached via the
>DJGPP forum, in case you have any questions.
Why should I modify the code when it is trivial to put the code into the
program? The only real problem with the code that you mentioned is that I
didn't lock the stack. Is this the only thing you found wrong with it? I
can easily add that, and I will.
>> IMHO anyway. After it grabs all available memory, the mem is locked and
>> paged in, and not given back until the program finishes.
>
>No, I don't think this will work like you intend. Do I understand
>correctly that you malloc all available physical memory and then lock
>it? If so, it might still fail to lock, because memory isn't paged in
>until it is really accessed (at least with some DPMI hosts, CWSDPMI is
>one such), and `malloc' doesn't access it. If you need to allocate
>the memory *and* page it in, you need to call `calloc', *then* lock
>it.
I do just that, but not with those particular functions. I use dmpi
functions to get the mem info, sbrk to get the mem and then lock it using
dpmi fucntions and finally use a simple for loop which touches all the
memory to make sure that it's there, much like the code I posted previously.
That is what I meant by "locking and paging it in." Where did you get the
idea that I didn't do these things?
- Raw text -