Huge amount of memory used
TadeasKriz opened this issue · comments
I have quite a large stylesheet file (2048 lines) and I found out that InterfaCSS takes awful lot of RAM. I run profiling and found out that InterfaCSS keeps allocated about 260MB of RAM. Most of the trace seems to be in [Parcoa parse]
.
Is this normal? And is it because of the large file? Even if I split it to multiple CSS files, I will still need to load them sooner or later and will get the memory usage that high again.
Any ideas?
It is linked to file size then. I tried removing half of the file (making it 1024 lines) and the memory was "only" 80MB (which is still around 80% of the whole app's memory consumption).
Is there any way to mitigate this?
I haven't observed this before myself, and I'm not able to reproduce it currently either. I didn't have any stylesheet quite as large as that handy, but I fiddled with the main.css file of the SimpleSample demo project to make it about a thousand lines long, but that didn't seem to affect memory usage.
Have you been able to pinpoint any specific style declarations that seem to result in this behaviour?
Hi again,
Have you been able to figure out anything more about what conditions seem to be causing the large memory footprint?
Hey, I'm sorry for no response from me. I found out that the memory consumption rose probably quadratically with the size of the stylesheet file. Also the startup of the application was very slow due to the file size. Unfortunately I had to fix it as soon as I could and since I'm no good with parsers, I wrote a very simple library for styling in Swift to cut down on the memory and computation requirements.
Hi, no worries, thanks for getting back on this.
A quadratic memory increase sounds bad indeed - could you mention something more about how your styles are organized? Or if you have an example stylesheet that you can share, that would be really helpful, since I've been unable to reproduce the memory issues thus far. If so, you can mail it to me directly if you wish.
Also, note that the stylesheet parsing performance has been significantly improved as of 1.4, mostly due to the use of a custom, more efficient, parser combinator framework. It may be that the introduction of this framework has had effects on memory consumption as well.