Mail Archives: djgpp/1999/09/27/02:34:22
Hi Eli,
You asked me for some code to reproduce the malloc
problem. It's here below.
> > I've tried this myself but it hangs because of
> some
> > problem with CWSDPMI (I think). The version of
> CWSDPMI
> > that quake uses doesn't give this problem.
>
> Please post the shortest test program that exhibits
> this problem.
>
This is that portion of the code which you asked for.
I have 64MB of RAM here and the program gets *stuck*
at 48MB. I've waited enough, so long that my hard disk
went off to sleep mode.
But there's one thing I have to comment. If I
decreased the memory allocation to 4MB per block, then
it works fine.
You may need to change the declaration of "x" if you
experiment with it.
*****************************************************
int _ctr0_startup_flags = _CRT0_FLAG_LOCK_MEMORY |
_CRT0_FLAG_FILL_SBRK_MEMORY;
int main()
{
_go32_dpmi_meminfo ret;
unsigned long maxmem, f, g = 0;
char *x[64];
_go32_dpmi_get_free_memory_information(&ret);
maxmem = ret.total_physical_pages;
for(f = 0; f < maxmem * 4 * 1024; f += 16 * 1024 *
1024L, g++)
{
x[g] = (char *)malloc(16 * 1024 * 1024L);
if (!x[g]) break;
printf("%luM memory malloc'd.\n", f / 1024L /
1024L);
_go32_dpmi_lock_data(x[g], 16 * 1024 * 1024L);
memset(x[g], 0, 16 * 1024L * 1024L);
}
return 0;
}
******************************************************
----
Prashant TR
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com
- Raw text -