Article View: comp.sys.mac
Article #9051Novice Programmer Question: Dynamic Memory Allocation under TC
From: David_Anthony_Guevara
Date: Thu, 07 Dec 1989 02:08
Date: Thu, 07 Dec 1989 02:08
20 lines
1563 bytes
1563 bytes
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
Technical Details
Message-ID:
<24770@cup.portal.com>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!usc!apple!fox!portal!cup.portal.com!David_Anthony_GuevaraShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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