Cog/Utils/RedundantPlaylistDataStore.h
Christopher Snowhill 5611d08df1 Reduce memory usage of adding tracks
Significantly reduce the memory footprint of adding tracks to the
playlist, by coalescing the NSString and NSData objects in the info
dictionaries as they are being loaded in the background, into a common
data set which will then be discarded when the whole job is completed.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-16 21:38:43 -08:00

27 lines
674 B
Objective-C

//
// RedundantPlaylistDataStore.h
// Cog
//
// Created by Christopher Snowhill on 2/16/22.
//
// This is designed primarily for the PlaylistEntry info loader, to prevent
// memory overrun due to redundant blobs of data being duplicated repeatedly
// until the list is fully loaded. This instance will be discarded after the
// info is loaded, freeing up hopefully way less memory afterward than now.
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface RedundantPlaylistDataStore : NSObject {
NSMutableArray *stringStore;
NSMutableArray *artStore;
}
- (id)init;
- (NSDictionary *)coalesceEntryInfo:(NSDictionary *)pe;
@end
NS_ASSUME_NONNULL_END