home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / programm / 13969 < prev    next >
Encoding:
Text File  |  1992-08-13  |  1.1 KB  |  52 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!caen!news
  3. From: Michael F. Kamprath <kamprath@caen.engin.umich.edu>
  4. Subject: calloc() makes my program hang
  5. Message-ID: <v5b-j!=@engin.umich.edu>
  6. Date: Thu, 13 Aug 92 21:16:13 EDT
  7. Organization: University of Michigan, Aerospace Engineering
  8. X-Useragent: Nuntius v1.1.1d5
  9. X-Xxdate: Thu, 13 Aug 92 21:16:16 GMT
  10. Nntp-Posting-Host: caenmac132.engin.umich.edu
  11. Lines: 39
  12.  
  13. I am using multiple calls to calloc in a subroutine that is called
  14. multiple times.  The subroutine works fine the first few times, but
  15. after a while, my program hangs at a call to calloc.  The general
  16. form to my program is:
  17.  
  18. foo(...)
  19. {
  20.     x = (double *)calloc(N +1, sizeof(double));
  21.     y = (double *)calloc(N + 1, sizeof(double));
  22.         .
  23.         .
  24.         .
  25.     free(y);
  26.     free(x);
  27. }
  28.  
  29. main()
  30. {
  31.         .
  32.         .
  33.     foo(...);
  34.         .
  35.         .
  36.     foo(...);
  37.         .
  38.         .
  39.         .
  40. }
  41.  
  42. You get the idea.  Anyways, the thrird or fourth call to foo() (not the
  43. real subroutine) would hang at one of the calloc() calls (thank apple
  44. for that <control><option><command>-<escape> quitter).  
  45.  
  46. What would this be an indication of?
  47.  
  48. Thanks for any help.
  49.  
  50. Michael F. Kamprath
  51. kamprath@caen.engin.umich.edu
  52.