Re: [GD-Consoles] Memory...
Brought to you by:
vexxed72
From: <chr...@pl...> - 2002-07-08 17:40:23
|
Mickael Pointier wrote: >> I would like to start my new engine using console friendly data structures >> and memory handling. Can someone help me with any tip? > >I would say that considering the small amount of memory >we have on console, you cannot really afford to loose >memory for trivial things. So instead of having a lot >of small new/deletes (each one coming with some memory >overhead: block chaining information...), you should >instead allocate large chunks of memory, and use placement >new (if using C++) in those blocs. > >The end result will be a gain in speed (during allocation >and deallocation phase), and a gain in memory if you manage >to allocate exactly what you need. Seconded. We have a custom memory manager that handles multiple heapzones in which you can do the following types of allocations: 1) Pools. Fast allocation/deallocation of fixed size objects. 2) Arenas. Fast allocation (only) of variable size objects. 3) Generic memory heap. Normal new/delete type allocations/ deallocations of arbitrary size objects. We try to use pools throughout for the reasons Mickael listed above (faster, uses less memory, also more memory coherent). So virtually all our classes have custom new/delete functions allocating from a pool. Our policy is to not do any generic new/delete calls when the game is running. (There's an exception or two, though.) Christer Ericson Sony Computer Entertainment, Santa Monica |