Page 1 of 1

Memory exhausted

Posted: Mon Apr 08, 2019 11:38 am
by pink
So I programmed an LCB library full of SVG icons from Icon54. It is huge, the library is around 7700 lines long.

At around line 7562 I received the error "Parsing error: memory exhausted"

So my question is, what are the limitations of an LCB library, and if I scaled back a little and successfully, how would it effect any builds that I created with it included? Would it seriously slow down the program or possibly have a dramatic influence of how much RAM and/or processing power needed?

Would it make more sense to make this into an LCS library, and load in smaller chunks when needed? Will I run into similar memory issues with it?

Re: Memory exhausted

Posted: Mon Apr 08, 2019 3:50 pm
by FourthWorld
~8k lines of text is not the problem. LC 9.x has addressed some memory leaks. Try the latest version and report back if the problem persists.

Re: Memory exhausted

Posted: Tue Apr 09, 2019 12:42 am
by pink
Happens in 9.0.2, 9.0.3, 9.0.4-RC2

Also, I forgot to mention, after this happens, if I try and save an open stack I get :

"Can 't save stack {STACKNAME} due to an error: can't open stack file"

Re: Memory exhausted

Posted: Wed Apr 10, 2019 12:05 pm
by LCMark
@pink: That error is generated by the lc-compile command-line tool which compiles lcb into modules. The error you are getting typically arises if you have a single handler with a very large number of commands in it (it's a limitation of the parser generator we use for the LCB parser). You can avoid the issue by splitting the handler up into several shorter handlers.

We had to do this for the iconSvg library which is shipped with the IDE:

https://github.com/livecode/livecode/bl ... consvg.lcb

Here you can see the fontawesome library has been setup by splitting into two handlers.

Re: Memory exhausted

Posted: Wed Apr 10, 2019 3:38 pm
by pink
that makes total sense, will give that a try

Thanks!
LCMark wrote:
Wed Apr 10, 2019 12:05 pm
@pink: That error is generated by the lc-compile command-line tool which compiles lcb into modules. The error you are getting typically arises if you have a single handler with a very large number of commands in it (it's a limitation of the parser generator we use for the LCB parser). You can avoid the issue by splitting the handler up into several shorter handlers.

We had to do this for the iconSvg library which is shipped with the IDE:

https://github.com/livecode/livecode/bl ... consvg.lcb

Here you can see the fontawesome library has been setup by splitting into two handlers.

Re: Memory exhausted

Posted: Wed Apr 24, 2019 3:43 pm
by pink
For the record breaking them up to smaller functions did the trick.