scope of malloc

Mark Ferraretto mferrare at adelphi.ua.oz.au
Wed Nov 7 13:24:49 AEST 1990


You see, I have this question...
	When malloc is called in a function and the scope of the pointer is
only that function is the memory deallocated when the pointer is (ie on exit
of the function?) deallocated?  Or does that chunk of memory hang around util
the program terminates?  I am calling several functions that involve a lot of
dynamic memory allocation most of which is only relevant to the scope of the
function where the memory is allocated.  These functions get called repeatedly.
So do I need to fill these functions to include free() calls with at the end
of each function?
	System:   SunOS 4.0.3, NewsOS
	compiler: cc (came with os in all cases)
	machines: sun4/280 sun3/60, News1580, News3410 (coming soon)
Thanks for your help.
Please e-mail to me as I don't usually read this newsgroup.
Mark Ferraretto
mferrare at physics.adelaide.edu.au
       _             Name  : Mark Ferraretto
      \  \           Place : Department of Physics and Mathematical Physics
 ||     \  \                 University of Adelaide
==========>==>==--   Aarnet: mferrare at physics.adelaide.edu.au



More information about the Comp.lang.c mailing list