Message-ID: <316E3E97.52B5@matrust.es> Date: Fri, 12 Apr 1996 12:29:27 +0100 From: Jesus Canal Organization: Digital Illusion (Grup Matrust) MIME-Version: 1.0 To: Massimiliano Mantione CC: djgpp AT delorie DOT com Subject: Re: malloc crash References: <316CE14F DOT 5DDE AT matrust DOT es> <316E12DC DOT 5B3 AT mailer DOT cefriel DOT it> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 --------------------------------------------------------------------------------