home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / programm / 13973 < prev    next >
Encoding:
Text File  |  1992-08-13  |  1.4 KB  |  57 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: Re: calloc() makes my program hang
  5. Message-ID: <c7b-ZN=@engin.umich.edu>
  6. Date: Thu, 13 Aug 92 23:00:44 EDT
  7. Organization: University of Michigan, Aerospace Engineering
  8. X-Useragent: Nuntius v1.1.1d5
  9. X-Xxdate: Thu, 13 Aug 92 23:00:49 GMT
  10. References: <v5b-j!=@engin.umich.edu>
  11. Nntp-Posting-Host: caenmac132.engin.umich.edu
  12. Lines: 43
  13.  
  14. In article <v5b-j!=@engin.umich.edu> Michael F. Kamprath, kamprath@caen.engin.umich.edu
  15. writes:
  16. >I am using multiple calls to calloc in a subroutine that is called
  17. >multiple times.  The subroutine works fine the first few times, but
  18. >after a while, my program hangs at a call to calloc.  The general
  19. >form to my program is:
  20. >
  21. >foo(...)
  22. >{
  23. >    x = (double *)calloc(N +1, sizeof(double));
  24. >    y = (double *)calloc(N + 1, sizeof(double));
  25. >        .
  26. >        .
  27. >        .
  28. >    free(y);
  29. >    free(x);
  30. >}
  31. >
  32. >main()
  33. >{
  34. >        .
  35. >        .
  36. >    foo(...);
  37. >        .
  38. >        .
  39. >    foo(...);
  40. >        .
  41. >        .
  42. >        .
  43. >}
  44. >
  45. >You get the idea.  Anyways, the thrird or fourth call to foo() (not the
  46. >real subroutine) would hang at one of the calloc() calls (thank apple
  47. >for that <control><option><command>-<escape> quitter).  
  48. >
  49. >What would this be an indication of?
  50.  
  51. Now this is weird.  I just reordered the calls to calloc() in my program,
  52. (there is actually five), and it works fine now.  What could cause this?
  53.  
  54.  
  55. Michael F. Kamprath
  56. kamprath@caen.engin.umich.edu
  57.