Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A lot of RAM usage #5

Open
s4reea opened this issue May 19, 2014 · 1 comment
Open

A lot of RAM usage #5

s4reea opened this issue May 19, 2014 · 1 comment

Comments

@s4reea
Copy link

s4reea commented May 19, 2014

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).

@jamikado
Copy link

jamikado commented Nov 5, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants