www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/12/06:39:25

Message-ID: <316E3E97.52B5@matrust.es>
Date: Fri, 12 Apr 1996 12:29:27 +0100
From: Jesus Canal <jesus AT matrust DOT es>
Organization: Digital Illusion (Grup Matrust)
MIME-Version: 1.0
To: Massimiliano Mantione <mantione AT ercole DOT cefriel DOT it>
CC: djgpp AT delorie DOT com
Subject: Re: malloc crash
References: <Pine DOT SUN DOT 3 DOT 91 DOT 960411075722 DOT 27263C-100000 AT is> <316CE14F DOT 5DDE AT matrust DOT es> <316E12DC DOT 5B3 AT mailer DOT cefriel DOT it>

Massimiliano Mantione wrote:
> 
> (...)
> private:
>    int      theHeight;
>    int      theWidth;
>    double  *theArray
>    double **theArrayRows
> 
> public:
>     inline double ZBufferElement(int X, int Y)
>         { return theArrayRows[X][Y]};
> (...)
> 
> and using a constructor that initializes the ``theArrayRows''
> pointers to the correct address of each row in ``theArray''.
> 
> With this trivial trick, you would:
> [1] Waste a bit of memory (but not so much, compared to the
>     whole ZBuffer).
> [2] malloc only once a great amount of memory, and then
>     manage to use it as you like (it was just what Eli was
>     telling you).
> 

Great ! I'll do this !

Thanks,

Jesus

-- 
--------------------------------------------------------------------------------
                                                DIGITAL ILLUSION * Grup Matrust
      Jesus Canal             Trav. de les Corts, 222 * 08028 Barcelona (Spain)
   Software Enginner               Tel. (34-3) 409 01 15 * Fax (34-3) 409 01 16
                                mailto:jesus AT matrust DOT es * http://www.matrust.es
--------------------------------------------------------------------------------

- Raw text -


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