-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Labels
Description
Whenever we try to save large files (>100MB, actual size depends on device capabilities) to cache, nothing happens except console log message like
*** mach_vm_map(size=997462016) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
The problem is in SPTPersistentCache method
- (NSError *)storeDataSync:(NSData *)data
forKey:(NSString *)key
ttl:(NSUInteger)ttl
locked:(BOOL)isLocked
withCallback:(SPTPersistentCacheResponseCallback)callback
onQueue:(dispatch_queue_t)queue
The following code does not work for large rawDataLength
NSMutableData *rawData = [NSMutableData dataWithCapacity:rawDataLength];
One way to handle large amounts of data is to fill temporary file with relatively small blocks of data first and then writing it atomically to target filePath
Reactions are currently unavailable