THINK C 4.0/3.0 & linked lists

Corrie corrie at serss0.fiu.edu
Tue Jul 24 18:03:45 AEST 1990


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 at fiu.edu  (internet)
	or
	corrie at servax   (bitnet)

Thankyou,
Corrie



More information about the Comp.lang.c mailing list