Avoiding Memory Fragmentation#
Memory Fragmentation generally is a bad thing. This is especially true for computer graphics applications. In addition to avoiding system memory fragmentation, a graphics application should strive to avoid video memory fragmentation as well.
Fortunately, controlling video memory fragmentation has techniques similar to those used to avoid system memory fragmentation. Since system memory fragmentation control is fairly well known, this document will only treat system memory issues in passing and focuses on video memory techniques.
- Video Memory Overview
- Allocating and Freeing Video Memory
- Best Practices for Video Memory Management
- 1. Allocate large buffers early
- 2. Combine many small allocations into a smaller number of larger allocations
- 3. Reduce the variation in size of allocated buffers ideally to a single size
- 4. Reuse, rather than free and reallocate, buffers whenever possible
- 5. Minimize dynamic allocation
- 6. Try to group dynamic allocations