Thank you for this great job. I love it very much.
I use it in my android project for parsing css file. every thing is good except OOM. I dived in codes, found this:
CSSLexer.java
static final short[][] DFA44_transition;
static {
int numStates = DFA44_transitionS.length;
DFA44_transition = new short[numStates][];
for (int i=0; i<numStates; i++) {
DFA44_transition[i] = DFA.unpackEncodedString(DFA44_transitionS[i]);
}
}
this static field cost too much memory: memory analyze report:
The class "cz.vutbr.web.csskit.antlr.CSSLexer", loaded by "dalvik.system.PathClassLoader @ 0xa4ebd5e0", occupies 13,901,544 (73.78%) bytes. The memory is accumulated in one instance of "short[][]" loaded by "<system class="" loader="">".
Could it improve?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
They have a patch that is applied on the file once it is generated. They are using jstyleparser-1.13 but probably the some thing (with minor modification) may be applied to the currrent version as well. If you are able to propose a better solution, I will be glad to include it in the project.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for this great job. I love it very much.
I use it in my android project for parsing css file. every thing is good except OOM. I dived in codes, found this:
CSSLexer.java
this static field cost too much memory: memory analyze report:
The class "cz.vutbr.web.csskit.antlr.CSSLexer", loaded by "dalvik.system.PathClassLoader @ 0xa4ebd5e0", occupies 13,901,544 (73.78%) bytes. The memory is accumulated in one instance of "short[][]" loaded by "<system class="" loader="">".
Could it improve?
Unfortunately, the CSSLexer.java file is generated automatically by ANTLR. It seems that people from Atlassian have already solved this problem:
https://bitbucket.org/atlassian/jstyleparser/commits/5f73ba00532a4aae972817d31fa0c1bbda78324c#chg-src/main/patches/CSSLexer-dfa-large-arrays.patch
They have a patch that is applied on the file once it is generated. They are using jstyleparser-1.13 but probably the some thing (with minor modification) may be applied to the currrent version as well. If you are able to propose a better solution, I will be glad to include it in the project.