Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jamesheliker

macrumors newbie
Original poster
Mar 9, 2011
3
0
Los Angeles, California
Hi All -

I'm running in to a disturbing failure with QTKit, I have a simple command line utility that trims N number of seconds from the beginning of a QTMovie object, and then writes that QTMovie object back to disk (to a new file).

The code compiles and runs flawlessly. The executable runs exactly as intended from the command line, provided that I run less than say, 10 instances simultaneously. If additional instances are running, two errors crop up in STDERR:

Code:
QTKitServer(94967,0xb038d000) malloc: *** error for object 0xffda: pointer being freed was not allocated 
*** set a breakpoint in malloc_error_break to debug

Code:
QTKitServer(95112,0xb0185000) malloc: *** error for object 0x221220: incorrect checksum for freed object - object was probably modified after being freed. 
*** set a breakpoint in malloc_error_break to debug

This utility is intended to be used with a very large corporate library of media files (all valid Quicktime mov's)
- and *anywhere from 1 to 1000 instances of the utility running at any one time is absolutely required.*

The "important code" is below:

Code:
NSNumber *yes = [NSNumber numberWithBool:YES];
NSDictionary *attrbs = [NSDictionary dictionaryWithObjectsAndKeys:
                        inputFilePath, QTMovieFileNameAttribute,
                        yes, QTMovieEditableAttribute,
                        nil];

QTMovie *movie = [[QTMovie alloc] initWithAttributes: attrbs error: nil];

long seconds = strtoull([secondsVal UTF8String], NULL, 0);
QTTime startTime = QTMakeTime(0, 1);
QTTime duration = QTMakeTime(seconds, 1);

QTTimeRange range = QTMakeTimeRange(startTime, duration);

[movie deleteSegment: range];

[NSDictionary *writeDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
                                 yes, QTMovieFlatten,
                                 nil];
[movie writeToFile: outputFilePath withAttributes: writeDictionary error: nil];

movie = nil;
[movie release];

Any help or insight would be GREATLY appreciated! :D

-James Heliker
james.heliker@gmail.com
 
I would file a bug with Apple, QTKitServer is actually the name of the process that branches off from QTKit applications that does the actual work(namely because most of QTKit is still really not 64 bit)

It does a lot of interprocess communication and it could very well be that by having 10 instances of QTKit running at the same time the communication is failing in some fashion and thus the QTKitServer malloc bugs.

File a report with Apple, include the code and explanation you wrote for this post. You could also try mailing the quicktime api support list, but more than likely all they are going to tell you to do is to file a bug report.
 
Last edited:
This is unlikely related to your problem, but:
movie = nil;
[movie release];

Is going to lead to the object movie was pointing to never getting the release message. This means a leak (though it sounds like the life of a process is processing one movie, then quitting).

-Lee
 
I would check the returns from your functions. does initWithAttributes:error: return a non-nil pointer? Does writeToFile:withAttributes:error return YES or NO when you get this failure? I think your best shot would be checking for this, and hopefully when this failure occurs you can detect it.

-Lee
 
I've implemented nil & YES/NO checks on both as you suggested - however both are returning normally even when QTKitServer is failing behind the scenes.

Since the error is showing up directly from QTKitServer, I'm not sure how else I would attempt to catch additional data?
 
Are you running this as x86_64 or i386? Maybe try i386 which may not require using QTKitServer (?).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.