UIImageJPEGRepresentation

Habe ich Schwierigkeiten Suche nach einem memory-leak, welches dann wieder bewirkt, dass meine App zum Absturz. Es scheint, dass der Speicher für die JPEGRepresentation nicht veröffentlicht. Dies ist noch merkwürdiger, weil das NSData-Objekt erstellt, indem UIImageJPEGRepresentation ist nur etwa 300 kb groß ist (hängt auf dem Bild), aber die Speicher-Auslastung springt von etwa 3-5 MB pro Bild in dieser Phase.

Dies ist der code

QueuedObject* queuedObject = [[QueuedObject alloc] init];
[queuedObject setUrl:url];

QueuedObjectData* jsonQueuedData = [[QueuedObjectData alloc] init];
[jsonQueuedData setData:jsonData];
[jsonQueuedData setFilename:@"message.json"];
[jsonQueuedData setContentType:@"application/json"];
[jsonQueuedData setKeyValue:@"JSONMessage"];
[queuedObject addData:jsonQueuedData];

int i=1;

QueuedObjectData* imageData = [[QueuedObjectData alloc] init];

for(id file in files)
{
    if(file!=nil)
    {
        [imageData setData:UIImageJPEGRepresentation(file, 0.8)];
        [imageData setFilename:[NSString stringWithFormat:@"image%d.jpg",i]];
        [imageData setContentType:@"image/jpeg"];
        [imageData setKeyValue:@"image"];
        [queuedObject addData:imageData];
        i++;
    }
}

[[UploadQueue sharedInstance] addObject:queuedObject];


[jsonQueuedData release];
[jsonData release];
[url release];
[imageData release];
[queuedObject release];

Haben Sie vielleicht eine Idee um mir zu helfen

beste Grüße
Manuel

InformationsquelleAutor Manuel | 2012-01-11

Schreibe einen Kommentar