Xref: utzoo comp.sys.mac:43692 comp.sys.mac.programmer:10964 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!usc!apple!fox!portal!cup.portal.com!David_Anthony_Guevara From: David_Anthony_Guevara@cup.portal.com Newsgroups: comp.sys.mac,comp.sys.mac.programmer Subject: Novice Programmer Question: Dynamic Memory Allocation under TC Message-ID: <24770@cup.portal.com> Date: 7 Dec 89 02:08:50 GMT Distribution: usa Organization: The Portal System (TM) Lines: 20 I have a very novice Mac programming problem. I wrote a program for a C class I'm taking that uses linked lists. The program runs fine on my VAX at work, but when I run it on my Mac under TC 4.0, it gets "lost". My question(s) is(are): When you use malloc to create a node (ex: head = (struct linked_list *) malloc (sizeof( ELEMENT ));) does the memory allocated come from the stack or the application heap? I believe my problem is that the Mac is relocating my pointers and the program just drops into a black hole. No bomb, but it just sits there until I reset the system. If the storage is allocated from the application heap, how can I make sure that nothing gets moved while the program is running? I'm not using any toolbox calls, should I be? As I said, the program DOES run on my VAX without any difficulty. My configuration is a Mac Plus w/4Mb RAM, Think C 4.0, System 6.02 with assorted inits and cdevs. Thanks for any help you can give me! Dave Guevara, Internet: guevara@fsd.arc.nasa.gov guevara@fsdvx2.arc.nasa.gov David_Anthony_Guevara@cup.portal.com