Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ncar!gatech!udel!haven.umd.edu!wam.umd.edu!dmb From: dmb@wam.umd.edu (David M. Baggett) Newsgroups: comp.sys.atari.st.tech Subject: Re: Problem with my C program [a few general hints about malloc] Message-ID: <1991Apr26.053743.12456@wam.umd.edu> Date: 26 Apr 91 05:37:43 GMT References: <1991Apr22.014758.3846@wam.umd.edu> <2913@atari.UUCP> Sender: usenet@wam.umd.edu (USENET Posting) Organization: University of Maryland at College Park Lines: 46 Nntp-Posting-Host: cscwam In refrence to my suggestion to avoid Bios Malloc, Allan Pratt writes: > >Humph. TOS 1.4 and upwards have NO PROBLEMS with Malloc that have been >reported to me. This has little bearing on the fact that TOS 1.2 and downwards DO have problems. I want my software to run on all ST's. Please understand that I wasn't trying to criticize you; in fact I realize that the whole situation has been made worse for you because lots of programmmers have _relied_ on the earlier bugs. Using Unix-compatible malloc routines provided in a compiler's libc.a is better than using Atari's Malloc binding because: 1) It works on all ST's (assuming said malloc is properly written) 2) It's more portable (does not assume longs are bigger than ints) 3) It's not prone to Malloc(1) versus Malloc(1L) bugs On the other hand, the drawbacks are: 1) It's slower 2) It adds code size to your executable It would be great if I could assume all ST's out there were running TOS 1.4, but I can't. I should think you'd want us to be writing stuff that is maximally machine-indpendent. I'm not being snide here; this is a thorny issue that ST programmers have to deal with. I've written lots of code using Malloc and lots of code using malloc -- I've never had problems with the Dlibs malloc routine, while the Bios Malloc (under TOS 1.2, I admit) caused me tremendous grief. If you thought I was just making some off the cuff slanderous remark, you were mistaken. I posted the advice I gave based on 4 years of heavy-duty ST programming, simply hoping to prevent others from wasting their time dealing with bugs and ideosyncracies I learned about the hard way several years ago. If Atari wants my opinion (which they probably don't), I think they should release "official" source code for malloc, calloc, and lalloc that works on all ST's and coalesces memory correctly. (Perhaps this would check the TOS version and just call the Bios for 1.4 and up.) Then we'd have a common denominator. This would also solve the problem of how to allocate more than 64K at a time. Dave Baggett dmb%wam.umd.edu@uunet.uu.net