Memory Management

No Default Dynamic Memory Allocation
The Nintendo 64 software does not impose a memory map on the game. The Nintendo 64 system leaves the memory allocation problem up to the game application. It assumes that the application knows the memory partitioning scheme most suitable for the particular game. However, the Nintendo 64 library does have a heap library that is available.

Region Library
The Nintendo 64 system provides a region allocation library that can partition a memory region specified by the application into a number of fixed-sized blocks. This gives the application the capability of using a dynamic memory allocation scheme. However, the game application must be able to handle situations where memory in the region has run out.

Memory Buffer Placement
There are some optimizations on the placement of memory buffers. For example, it is best to keep the color and depth buffers on separate 1 MB memory banks. The RDRAM has an active page register for each megabyte. Splitting the color and z-buffers into separate megabytes prevents the memory system from constantly having to change the page register. This technique minimizes page misses.

Memory Alignment
The DMA engines responsible for shuffling data around in the hardware all require the 64-bit aligned source address, the destination address, and lengths. Addresses in ROM do not have this 64-bit alignment restriction. ROM addresses only need to be 16-bit aligned. The loader from the compiler suite (see the man page for ld (1)) makes sure that all C-language long long types are 64-bit aligned. Using C language, the stack for a thread must also be 64-bit aligned. Therefore, all stacks should be defined as long long and type-casted when calling osCreateThread. See the man page for additional details.

Copyright © 1999
Nintendo of America Inc. All Rights Reserved
Nintendo and N64 are registered trademarks of Nintendo
Last Updated January, 1999