home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!caen!news
- From: Michael F. Kamprath <kamprath@caen.engin.umich.edu>
- Subject: Re: calloc() makes my program hang
- Message-ID: <c7b-ZN=@engin.umich.edu>
- Date: Thu, 13 Aug 92 23:00:44 EDT
- Organization: University of Michigan, Aerospace Engineering
- X-Useragent: Nuntius v1.1.1d5
- X-Xxdate: Thu, 13 Aug 92 23:00:49 GMT
- References: <v5b-j!=@engin.umich.edu>
- Nntp-Posting-Host: caenmac132.engin.umich.edu
- Lines: 43
-
- In article <v5b-j!=@engin.umich.edu> Michael F. Kamprath, kamprath@caen.engin.umich.edu
- writes:
- >I am using multiple calls to calloc in a subroutine that is called
- >multiple times. The subroutine works fine the first few times, but
- >after a while, my program hangs at a call to calloc. The general
- >form to my program is:
- >
- >foo(...)
- >{
- > x = (double *)calloc(N +1, sizeof(double));
- > y = (double *)calloc(N + 1, sizeof(double));
- > .
- > .
- > .
- > free(y);
- > free(x);
- >}
- >
- >main()
- >{
- > .
- > .
- > foo(...);
- > .
- > .
- > foo(...);
- > .
- > .
- > .
- >}
- >
- >You get the idea. Anyways, the thrird or fourth call to foo() (not the
- >real subroutine) would hang at one of the calloc() calls (thank apple
- >for that <control><option><command>-<escape> quitter).
- >
- >What would this be an indication of?
-
- Now this is weird. I just reordered the calls to calloc() in my program,
- (there is actually five), and it works fine now. What could cause this?
-
-
- Michael F. Kamprath
- kamprath@caen.engin.umich.edu
-