Important: The information in this document is obsolete and should not be used for new development.
Determining Memory Requirements for a Graphics Client HeapUsing the optimal heap size increases the performance of your application. If your application does not allocate sufficient memory, QuickDraw GX will need to add additional memory blocks to the initial graphics client heap. If your heap is sized too large, you are wasting memory space.
You can use the QuickDraw GX GraphicsBug utility to check the actual size of your graphics client heap to ensure that your application has allocated sufficient, but not excessive, memory. Once you determine the optimal graphics client heap size for your application, you can specify this size at the beginning of your application by using the
You can use the following procedure to determine the memory requirements of your graphics client heap:
Repeat these steps varying the size of the document used in step 2.
- Start your application with the
GXNewGraphicsClientfunction and specify a memory size, such as 1 MB.
- Run your application and create a document. QuickDraw GX allocates or deallocates memory blocks to a size that it deems necessary and sufficient to accommodate the number and complexity of the objects you have created.
- Use the Heap Total (
HT) GraphicsBug command to determine the memory size that QuickDraw GX is currently using. This is the size of the graphics client heap.
- Use the
GXNewGraphicsClientfunction to specify the size of the QuickDraw GX graphics client heap to accommodate the actual memory required.
By running your application with what you would consider to be a document of average size and then with a document of large size, you can arrive at an optimum graphics client heap size that is probably somewhere between these two heap sizes. One important consideration is to ensure that your largest objects have sufficient memory allocated for the graphics client heap that they reside in. This is because an object cannot be split into multiple memory blocks in the heap.
Because QuickDraw GX can grow the heap to accommodate the needs of your application, you don't need to allocate sufficient space for your largest document. Assuming you have not passed the
GXNewGraphicsClient. This procedure provides only a preliminary evaluation of the memory requirements for your application.
For additional information on how to use the GraphicsBug utility, see the section "Debugging With GraphicsBug" in the chapter "QuickDraw GX Debugging," in this book.