Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!uxc.cso.uiuc.edu!uxc.cso.uiuc.edu!m.cs.uiuc.edu!rudolph From: rudolph@m.cs.uiuc.edu Newsgroups: comp.sys.mac.programmer Subject: malloc in LSC Message-ID: <73300002@m.cs.uiuc.edu> Date: 18 Jul 89 05:26:00 GMT Lines: 21 Nf-ID: #N:m.cs.uiuc.edu:73300002:000:1001 Nf-From: m.cs.uiuc.edu!rudolph Jul 18 00:26:00 1989 Are there any known problems with malloc, calloc, etc in LSC? I have a program that is basically Unix-style - the only Mac-type stuff is a call to SFGetFile. When I call malloc(), I get strange results. If I statically allocate the array, it works fine. It also works fine using malloc() with the exact same code (minus SFGetFile) on a Unix machine. At first, malloc() was returning suspiciously low addresses (4 digit hex numbers, so < 64K). When I wrote to these addresses, the Mac eventually crashed. The I tried removing all my INITs, and it started returning ridiculously high address (8 hex digits starting with ffff). Reading from these produced garbage. I'm only trying to allocate about 500 bytes at a time. This is all on a Plus with 1M and no multifinder, sys 6.0. I'm not experienced at Mac programming, but I am at 'C,' and I can't find anything wrong with what I'm doing, especially since it works under Unix. David Rudolph rudolph@m.cs.uiuc.edu University of Illinois