From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Optimization Date: Thu, 28 Nov 1996 19:38:52 -0800 Organization: Three pounds of chaos and a pinch of salt Lines: 24 Message-ID: <329E5ACC.A50@cs.com> References: <329E325F DOT 3FDE AT gbrmpa DOT gov DOT au> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp101.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: leathm AT gbrmpa DOT gov DOT au DJ-Gateway: from newsgroup comp.os.msdos.djgpp Leath Muller wrote: > > Actually, if I have a subroutine, which contains a _lot_ of local variables, > does malloc _really_ get called all the time? I profiled my texture mapping > code, and found that the malloc() routine was taking up about 17% of the > program execution time. > > Does this sound right? If it is, I think I will be moving to a lot of > globals instead... Nope. Local variables are always allocated off of the stack. There is no way that your program can call malloc() unless you use code which explicitly requests it. (aside from the startup code, of course, although I think that uses sbrk() not malloc()...) -- John M. Aldrich, aka Fighteer I -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS d- s+:- a-->? c++>$ U@>++$ p>+ L>++ E>+ W++ N++ o+ K? w(---) O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+ tv+() b+++ DI++ D++ G e(*)>++++ h!() !r !y+() ------END GEEK CODE BLOCK------