Path: chuka.playstation.co.uk!news From: "Mark Wilson" Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: General question. Date: Thu, 7 May 1998 22:29:37 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 29 Message-ID: <6it964$aek5@chuka.playstation.co.uk> References: <3551E529.39700A51@chowfam.demon.co.uk> <6isrju$aek3@chuka.playstation.co.uk> <35520452.5385308E@netmagic.net> <35521703.6AC7A819@chowfam.demon.co.uk> NNTP-Posting-Host: userm879.uk.uudial.com X-Newsreader: Microsoft Outlook Express 4.72.2106.4 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 >How do you free the space used up by the TIMs after transferring them >to VRAM? >But they weren't malloc'ed in the first place. They were just put there. > But malloc just returns a pointer to some memory that the system knows is free. When you've finished with a TIM you have a pointer to some memory that your program knows is free. An example: say you have a TIM file that is 0x1000 bytes long located at 0x80090000. You've loaded it into the frame buffer and now it's no longer needed. Now, your program, for whatever reason, needs a table 0x1000 bytes large (how convenient ;-) which it creates dynamically, perhaps a list of sprite coordinates or unpacked level data. To use the memory that the TIM occupied as a table you'd just do something like int i; u_char *MyTable; MyTable = (u_long)0x80090000; // Clear table for (i = 0; i < 0x1000; i++) *MyTable++ = 0; Mark