RE: [GD-General] Compile times
Brought to you by:
vexxed72
From: Mick W. <mi...@ne...> - 2002-12-18 01:10:16
|
> -----Original Message----- > From: gam...@li... > [mailto:gam...@li...] On > Behalf Of Josiah Manson > Sent: Tuesday, December 17, 2002 6:11 PM > To: gam...@li... > Subject: Re: [GD-General] Compile times > > > Maybe I am totally off base here, but it seems to me that if > you really want to prevent fragmentation, for example in a > server that has a really long up time, the best thing to do > would be to use smart pointers of some sort. > > By not having your pointers directly point to a memory > location, this allows you to change what the pointer points > to. It seems to me that having this additional abstraction > would allow you to periodically defragment memory, and the > programmer wouldn't have to worry about the details at all. > It just works. > Sounds good in theory, and I'm sure it has been tried many times. Smart pointer are not free. For it to to help with fragmentation you have to apply it to EVERYTHING, which starts to add up. There is the additional memory required to store it (8-16+ bytes, depending on implementation). Then there is the code bloat (in your executable size) due to all the extra code generated for the double dereferencing, which takes up memory. Then there is the extra CPU time taken up by this code, and the extra meory access (not cheap on the PS2, trashing the cache and all that). For that, you need to do a cost-benefit analysis, is it worth it? What do you gain? And even though, in theory, you should simply be able to replace "regular" pointers with smart pointers; in practice there will be numerous problems related to this changeover. Also, not every block of memory can be made movable. DMA packets on the PS2 can contain absolute addresses. 3rd party libraries like Renderware might not be malleable enough to use your smart system. I'd like to hear from anyone who uses a fully smart pointer based memory allocation scheme with movable blocks. I don't think you can do it, and still ship a game. Mick |