cloudinary_ios icon indicating copy to clipboard operation
cloudinary_ios copied to clipboard

For upload, consider using [NSMutableURLRequest setHTTPBodyStream] instead of setHTTPBody

Open martin-gearzero opened this issue 10 years ago • 0 comments

Hi there,

I wanted to make a quick suggestion.

Cloudinary can use a significant amount of memory, particularly when uploading videos or large photos because image/video data must be fully loaded into RAM before being sent over the wire.

It looks as though NSMutableURLRequest supports setting an body stream instead of data.

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
NSInputStream *stream = [[NSInputStream alloc] initWithFileAtPath:filePath];
[request setHTTPBodyStream:stream];

This might be something worth looking into to reduce Cloudinary's memory footprint.

Thanks, Martin

martin-gearzero avatar Jan 06 '16 22:01 martin-gearzero