MultistrokeGestureRecognizer-iOS icon indicating copy to clipboard operation
MultistrokeGestureRecognizer-iOS copied to clipboard

A lot of RAM usage

Open s4reea opened this issue 11 years ago • 1 comments

Thanks guys for the efforts ! I got a little problem through it, once i load the app with 5 templates it generates 350~ templates and takes a lot of seconds to launch, and uses 150mb of ram while launching. I am planning on adding 22 templates, is there a way to overcome this problem?

I know i can launch the templates loading on another thread to overcome the blocking and waiting it to launch, but if 5 templates are taking 150mb RAM then 22 are going to crash the app i guess.

P.S. I used the code of the DEMO as a first step, the only difference is that i migrated it to storyboards (copied the necessary methods to a new project and then used the storyboard to show the text).

s4reea avatar May 19 '14 13:05 s4reea

I realize this is an older post, but wanted to know if others ended up agreeing on the best way to improve the startup memory use (as the original poster mentions this is excessive on mobile). Just as a simple test I added a simple autorelease pool wrapper inside the for loop of: https://github.com/britg/MultistrokeGestureRecognizer-iOS/blob/master/WTMGlyph/WTMGlyph.m#L64

Converted:

for (NSArray *unistroke in unistrokes) {
        WTMGlyphTemplate *newTemplate = [[WTMGlyphTemplate alloc] initWithName:self.name
                                                                        points:unistroke];
        [self.templates addObject:newTemplate];
    }

to

for (NSArray *unistroke in unistrokes) {
       @autoreleasepool {
           WTMGlyphTemplate *newTemplate = [[WTMGlyphTemplate alloc] initWithName:self.name
                                                                        points:unistroke];
           [self.templates addObject:newTemplate];
        }
    }

and the memory footprint on startup is very stable and doesnt explode even if you load the entire A-Z templates set

jamikado avatar Nov 05 '15 14:11 jamikado