Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: QTKit memory leak.



The line:

newImage = [ theMovie currentFrameImage ];

is probably allocating an entire new NSImage in memory which doesn't get released until the autorelease pool has time to pop. Try wrapping the loop block in pool of its own:

while( NSOrderedSame != QTTimeCompare([ theMovie currentTime ],endTime) )
{
NSAutoreleasePool *loopPool = [[NSAutoreleasePool alloc] init];


    newImage = [ theMovie currentFrameImage ];
    [ newImage lockFocus ];
    [ newImage unlockFocus ];

    [loopPool release];
}

That should prevent the allocated images from hanging around too long.

-Henry

On Aug 30, 2005, at 2:35 AM, MUHAMMAD ALI T K wrote:

Hi,

I am using QTKit 7 API for processing my movies.
My attempt is to create a new movie from an existing one.

I accomplish this by stepping through each frame image of the source movie,
processing that image and then adding these images to the destination movie
specifying the codec and quality.


The sample codlet follows,

QTMovie* theMovie = [ [ QTMovie alloc ] initWithFile:@"Cinepak.avi"

error:nil ];

NSImage* newImage =  nil;
QTTime endTime = [ theMovie duration ];

while( NSOrderedSame != QTTimeCompare([ theMovie currentTime ],endTime) )
{
newImage = [ theMovie currentFrameImage ];
[ newImage lockFocus ];
[ newImage unlockFocus ];


    }
    [ theMovie release ];


While taking the current frame image and processing it, the application
consumes a lot of memory. Do we need anymore steps or implement any delegate
method so as to avoid this problem?


Any positive response is appreciated.
Thanks in Advance,
Muhammad Ali TK

---------------------------------------------------------------------- -----
"This e-mail and any files transmitted with it are for the sole use
of the intended recipient(s) and may contain confidential and privileged
information. If you are not the intended recipient, please contact the
sender by reply e-mail and destroy all copies of the original message.


Any unauthorized review, use, disclosure, dissemination, forwarding,
printing or copying of this email or any action taken upon this e- mail is
strictly prohibited and may be unlawful."
---------------------------------------------------------------------- -----
_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/email@hidden


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. QuickTime-API mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quicktime-api/email@hidden

This email sent to email@hidden
References: 
 >QTKit memory leak. (From: MUHAMMAD ALI T K <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.