Article View: comp.os.os2.programmer
Article #3421malloc() and swapper.dat problems ....
From: Takis Skagos
Date: Sun, 10 Jan 1993 20:04
Date: Sun, 10 Jan 1993 20:04
56 lines
2348 bytes
2348 bytes
Hi,
I was curious to see how OS/2 handled malloc()ing big chunks of
memory, so I wrote a quick and really-dirty program last night to
test out some stuff. Anyway, the program dumped core before
completing. Here is a copy of the code and following that is a
copy of what was displayed when the program dumped. By the way,
I used "icc -c-" and "icc -c- -gd+" to compile the program, but the
same thing happened either way.
---source code---
#include <stdio.h>
main()
{
int k = 0;
int *p;
setbuf(stdout,NULL); setbuf(stdin,NULL);
p = (int *) malloc(12000000); /* bytes */
printf("\n malloced 12000000 bytes.");
while(k < 10000000 )
{
p[k] = 1;
k++;
if(k % 10000 == 0)
putchar('.');
}
free(p);
printf("\n freed 12000000 bytes.\n");
}
---output---
[d:\taki\misc\misc1]MAL.exe
malloced 12000000 bytes........................................................
................................................................................
................................................................................
................................................................................
.....General Protection Fault exception occurred at EIP = 0001005B on thread 000
1.
Register Dump at point of exception:
EAX = 000D0010 EBX = 00000000 ECX = 002DC7FC EDX = 0000013C
EBP = 00022C3C EDI = 00000000 ESI = 00000000 ESP = 00022C0C
CS = 005B CSLIM = 1BFFFFFF DS = 0053 DSLIM = 1BFFFFFF
ES = 0053 ESLIM = 1BFFFFFF FS = 150B FSLIM = 00000030
GS = 0000 GSLIM = 00000000 SS = 0053 SSLIM = 1BFFFFFF
Process terminating.
I still had plenty of space left on my swap partition, so I don't know
why it crapped out. Any info would be appreciated. Thanks.
P. Takis Skagos
(skagos@cs.uregina.ca)
Technical Details
Message-ID:
<1993Jan10.200412.454149@sue.cc.uregina.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!newsflash.concordia.ca!mizar.cc.umanitoba.ca!access.usask.ca!sue!mercury.cs.uregina.ca!skagosReferences:
<1ipnriINNsm5@im4u.cs.utexas.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.os2.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!newsflash.concordia.ca!mizar.cc.umanitoba.ca!access.usask.ca!sue!mercury.cs.uregina.ca!skagos From: skagos@mercury.cs.uregina.ca (Takis Skagos) Subject: malloc() and swapper.dat problems .... Sender: news@sue.cc.uregina.ca Message-ID: <1993Jan10.200412.454149@sue.cc.uregina.ca> Date: Sun, 10 Jan 1993 20:04:12 GMT References: <1ipnriINNsm5@im4u.cs.utexas.edu> Organization: University of Regina, SK, Canada Lines: 57