Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!shelby!csli!dmr From: dmr@csli.Stanford.EDU (Daniel M. Rosenberg) Newsgroups: comp.sys.mac.programmer Subject: I can't malloc Message-ID: <14983@csli.Stanford.EDU> Date: 20 Aug 90 20:18:33 GMT Sender: dmr@csli.Stanford.EDU (Daniel M. Rosenberg) Organization: World Otherness Ministries Lines: 25 It used to be pretty easy for me to program in C on some UNIX box, but at the moment I'm writing a C application making heavy use of inline assembly code (in Think C 4.0) on a Macintosh. calloc and malloc don't seem to return anything, so I figured I did it wrong. I then said to me, hey, why not be Mac-like, and try NewHandle? Which I did, and got a pointer to a pointer to some area of memory, which I promptly filled up (I asked for 5000 * 2 bytes and filled it with 5000 words) and which promptly crashed the machine. I filled the memory with assembly code, loading an address register with the memory location. Anyhow, I'm making some obvious mistake, but my frustration level during the past week has been such that I have gotten nowhere. Does anyone have a short code segment showing some simple memory allocation off the heap, and how to access it? I'd be forever grateful. Thanks, Dan -- # Daniel M. Rosenberg // Stanford CSLI // Chew my opinions, not Stanford's. # dmr@csli.stanford.edu // decwrl!csli!dmr // dmr%csli@stanford.bitnet