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

[makeotfexe] Feature files causes huge memory consumption #965

Closed
khaledhosny opened this issue Sep 20, 2019 · 6 comments · Fixed by #968
Closed

[makeotfexe] Feature files causes huge memory consumption #965

khaledhosny opened this issue Sep 20, 2019 · 6 comments · Fixed by #968

Comments

@khaledhosny
Copy link
Collaborator

While porting feaLib tests to makeotfexe, I came accross a seemingly innocent file that causes makeotfexe to consume huge amount of memory (not sure if it is leaking memory or not), it basically consumed all available memory. I tried to debug it, but it is rather difficult when it causes the OS to start killing applications to free memory.

The file (from fonttools/fonttools#1307).

@cjchapman
Copy link
Contributor

@khaledhosny I'll look into it. Thanks.

@cjchapman
Copy link
Contributor

@khaledhosny Looks like it's stuck in an infinite loop here:

for (i = 0; i < h->DFLTLkps.cnt; i++) {
State *st = &h->DFLTLkps.array[i];
callLkp(st);
}

...because something in the callLkp() call stack keeps causing h->DFLTLkps.cnt to increment.

@cjchapman
Copy link
Contributor

...this, specifically:

if (accumDFLTLkps) {
/* Save for possible inclusion later in lang-specific stuff */
*dnaNEXT(h->DFLTLkps) = h->curr;
}

@cjchapman
Copy link
Contributor

@khaledhosny I have to leave now due to family commitments. If you want to take it from here, great, if not, I'll plan on picking this back up on Monday.

@khaledhosny
Copy link
Collaborator Author

khaledhosny commented Sep 21, 2019

I’m not having much luck with debugging. This is the smallest file to trigger the infinite loop.

languagesystem DFLT dflt;
lookup b {
    sub b by B;
} b;
lookup c {
    sub c by C;
} c;
feature liga {
    lookup b;
    script DFLT;
        lookup c;
        language dflt;
            lookup c;
} liga;

@cjchapman
Copy link
Contributor

@khaledhosny OK, no worries, I'll plan on working on this when I get back to the office on Monday.

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

Successfully merging a pull request may close this issue.

2 participants