Xref: utzoo comp.sys.mac.programmer:16221 comp.lang.c:30554 Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!kluge!serss0!corrie From: corrie@serss0.fiu.edu (Corrie) Newsgroups: comp.sys.mac.programmer,comp.lang.c Subject: THINK C 4.0/3.0 & linked lists Summary: having problems with dynamic allocation on a 4Meg Mac Plus Keywords: THINK, C, malloc, calloc, allocation, list Message-ID: <1023@kluge.fiu.edu> Date: 24 Jul 90 08:03:45 GMT Sender: news@kluge.fiu.edu Followup-To: corrie@fiu.edu Distribution: na Organization: Florida International University, Miami Lines: 38 I am having problems allocating memory for a very simple linked list on my 4 Meg Mac+. In TC-4.0 I usually cannot even manage to get 2 nodes created. I re-loaded my THINK Lightspeed C 3.0 and was able to get a better response of about 10-15 nodes being created. This should not happen this way. TC-4.0 should be just as good as TLC-3.0 at allocating space. In addition, free() does not seem to be freeing anything. In subsiquent runs, the system runs out of memory, crashes, or (in TLC-3.0 only) displays a dialog box stating that the program has been unexpectantly exited. I even went as far as printing out the value of sizeof(Node), which to no surprise was only 6. Now, how can 6 bytes of memory times only 3 nodes cause my machine to run out of memory. The project has plenty of room to run in. I free() the list at the end. In addition, the program works fine on our VAX-8800 without modification. I have noticed, that there have been a number of questions pertaining to memory allocation using TC-4.0 this morning. Is there a problem with the way TC allocates memory, or the way the Mac handles memory. I would like to be able to write 'pure' c code, and have it work. Any suggestions/explanations ??? Aside: Has anyone heard of any C++ translator/compilers for the Mac ? Hopefully something which is 'real' C++, not those 'OOP' extentions of TC-4.0. Multiple inheritance and polymorphism is a good thing. Please send any replys to: corrie@fiu.edu (internet) or corrie@servax (bitnet) Thankyou, Corrie