Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

New APIs For Controlling Memory Usage in Movies

QuickTime 6 introduces new APIs for applications that want to exercise very fine-grained control over how memory is used by movies. Most applications, however, will not need to use these APIs, which were first introduced in Mac OS X 10.1, and only work in Mac OS X.

On Mac OS 9, collections of media data (called chunks) that were recently used are, under certain conditions, allowed to persist in handles in the application heap with the “purgeable” flag set. If the memory manager needs to reclaim their memory for other purposes, those handles are automatically emptied. If QuickTime needs the chunks again before they are emptied, it simply clears the purgeable flag and uses them, avoiding the need to reload the data.

The Mac OS X Carbon Memory Manager does not currently implement the purgeable flag, relying instead on the virtual memory system. However, the concept of a “purgeable chunk” is still valuable for QuickTime, since it identifies chunks that were recently needed and may be needed again in the near future (perhaps depending on user action). In Mac OS X 10.1 and later, QuickTime keeps track of purgeable chunks. If the total amount of memory occupied by them exceeds a per-application threshold called the purgeable chunk memory allowance, QuickTime empties chunks until the total size is under it. This behavior can be turned on and off using the MediaSetChunkManagementFlags function, and the allowance can be configured using the MediaSetPurgeableChunkMemoryAllowance function. Should you want to force QuickTime to empty all purgeable chunks, you can call the MediaEmptyAllPurgeableChunks function.

MediaSetChunkManagementFlags

Sets application-global flags controlling chunk management.

pascal ComponentResult MediaSetChunkManagementFlags (
MediaHandler mh,
UInt32 flags,
UInt32 flagsMask);

Discussion

Currently the only flag is kEmptyPurgableChunksOverAllowance, which is TRUE by default.

Availability
Declared In
MediaHandlers.h

MediaGetChunkManagementFlags

Returns the current settings of chunk management flags.

pascal ComponentResult MediaGetChunkManagementFlags (
MediaHandler mh,
UInt32 *flags);

Version Notes

WARNING - Do not call this function under QuickTime 5.0.x. It could cause a crash.

Availability
Declared In
MediaHandlers.h

MediaSetPurgeableChunkMemoryAllowance

Configures the maximum amount of memory that QuickTime will allow purgeable chunks to occupy.

pascal ComponentResult MediaSetPurgeableChunkMemoryAllowance (MediaHandler mh,
Size allowance);

Discussion

This routine configures the maximum amount of memory that QuickTime will allow purgeable chunks to occupy. This is an application-global setting.

Availability
Declared In
MediaHandlers.h

MediaGetPurgeableChunkMemoryAllowance

Returns the current purgeable chunk memory allowance.

pascal ComponentResult MediaGetPurgeableChunkMemoryAllowance (MediaHandler mh,
Size *allowance);

Discussion

This routine returns the current purgeable chunk memory allowance.

Availability
Declared In
MediaHandlers.h

MediaEmptyAllPurgeableChunks

Forces QuickTime to empty all purgeable chunks in this application.

pascal ComponentResult MediaEmptyAllPurgeableChunks (MediaHandler mh);

Availability
Declared In
MediaHandlers.h

< Previous PageNext Page > Hide TOC


Last updated: 2002-07-01




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice