HI, I've been trying to do a batch converter for images. The problem
is the memory is not being released properly. When the for ends the
memory is ok, but during the for it continues increasing. I have a
function with a for loop:
for(count=0;count<cant;count++)
{
path=[datos objectAtIndex:count];
save_name=[NSString stringWithFormat:
@[EMAIL PROTECTED]
"image_%04d.jpg",count+1];
output=[[batch_outdir stringValue]
stringByAppendingPathComponent:save_name];
[self convert:path path_out:output format:NSJPEGFileType quality:
0.3];
}
and then the conversion function
-(void)convert:(NSString*)path_in path_out:(NSString*)path_out format:
(NSBitmapImageFileType)type quality:(float)q
{
NSDictionary *d=[NSDictionary dictionaryWithObject:
[NSNumber numberWithFloat:q]
forKey:NSImageCompressionFactor];
NSImage *tmp_img;
NSBitmapImageRep *b;
NSData *data;
tmp_img=[[NSImage alloc] initWithContentsOfFile:path_in];
b=[NSBitmapImageRep imageRepWithData:[tmp_img TIFFRepresentation]];
[tmp_img release];
data=[b representationUsingType:tipo properties:d];
[data writeToFile:path_out atomically:TRUE];
}