home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / os2 / programm / 7478 < prev    next >
Encoding:
Text File  |  1993-01-10  |  2.2 KB  |  69 lines

  1. Newsgroups: comp.os.os2.programmer
  2. Path: sparky!uunet!newsflash.concordia.ca!mizar.cc.umanitoba.ca!access.usask.ca!sue!mercury.cs.uregina.ca!skagos
  3. From: skagos@mercury.cs.uregina.ca (Takis Skagos)
  4. Subject: malloc() and swapper.dat problems ....
  5. Sender: news@sue.cc.uregina.ca
  6. Message-ID: <1993Jan10.200412.454149@sue.cc.uregina.ca>
  7. Date: Sun, 10 Jan 1993 20:04:12 GMT
  8. References: <1ipnriINNsm5@im4u.cs.utexas.edu>
  9. Organization: University of Regina, SK, Canada
  10. Lines: 57
  11.  
  12. Hi,
  13.  
  14.   I was curious to see how OS/2 handled malloc()ing big chunks of
  15. memory, so I wrote a quick and really-dirty program last night to
  16. test out some stuff.  Anyway, the program dumped core before
  17. completing.  Here is a copy of the code and following that is a
  18. copy of what was displayed when the program dumped.  By the way,
  19. I used "icc -c-" and "icc -c- -gd+" to compile the program, but the
  20. same thing happened either way.
  21.  
  22. ---source code---
  23.  
  24. #include <stdio.h>
  25.  
  26. main()
  27. {
  28.   int k = 0;
  29.   int *p;
  30.   setbuf(stdout,NULL); setbuf(stdin,NULL);
  31.   p = (int *) malloc(12000000);  /* bytes */
  32.   printf("\n malloced 12000000 bytes.");
  33.   while(k <           10000000 )
  34.   {
  35.     p[k] = 1;
  36.     k++;
  37.     if(k % 10000 == 0)
  38.       putchar('.');
  39.   }
  40.   free(p);
  41.   printf("\n freed 12000000 bytes.\n");
  42. }
  43.  
  44. ---output---
  45.  
  46. [d:\taki\misc\misc1]MAL.exe
  47.  
  48.  malloced 12000000 bytes........................................................
  49. ................................................................................
  50. ................................................................................
  51. ................................................................................
  52. .....General Protection Fault exception occurred at EIP = 0001005B on thread 000
  53. 1.
  54. Register Dump at point of exception:
  55. EAX = 000D0010    EBX = 00000000  ECX = 002DC7FC    EDX = 0000013C
  56. EBP = 00022C3C    EDI = 00000000  ESI = 00000000    ESP = 00022C0C
  57. CS =     005B  CSLIM = 1BFFFFFF   DS =     0053  DSLIM = 1BFFFFFF
  58. ES =     0053  ESLIM = 1BFFFFFF   FS =     150B  FSLIM = 00000030
  59. GS =     0000  GSLIM = 00000000   SS =     0053  SSLIM = 1BFFFFFF
  60. Process terminating.
  61.  
  62.  
  63. I still had plenty of space left on my swap partition, so I don't know
  64. why it crapped out.  Any info would be appreciated.  Thanks.
  65.  
  66.   P. Takis Skagos
  67.   (skagos@cs.uregina.ca)
  68.  
  69.