www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/28/20:20:10

From: "John M. Aldrich" <fighteer AT cs DOT com>
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: <Pine DOT SGI DOT 3 DOT 93 DOT 961128220927 DOT 4515B-100000 AT gibson DOT eee DOT upd DOT edu DOT ph> <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
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 <fighteer AT cs DOT com>

-----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------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019