Freeing Memory
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Freeing Memory
Hi All
I hope everyone is well.
I have a script which repeat multiple times printing PDFs. at the end of the repeat the printing is closed.
If I carry out this script multiple times LiveCode crashes.
I opened up task manager and watched what happened each time and each time the script is run the memory used by LC increases until eventually LC is using so much memory that it crashes.
• I have tried closing the stack where the print script is running after each operation to see if it would free up the memory, but it doesnt.
• I have looked through the variables to make sure there are no large ones remaining each time
I cant figure out what or where LC is holding in memory or where it is holding it, any ideas?
Many Thanks
I hope everyone is well.
I have a script which repeat multiple times printing PDFs. at the end of the repeat the printing is closed.
If I carry out this script multiple times LiveCode crashes.
I opened up task manager and watched what happened each time and each time the script is run the memory used by LC increases until eventually LC is using so much memory that it crashes.
• I have tried closing the stack where the print script is running after each operation to see if it would free up the memory, but it doesnt.
• I have looked through the variables to make sure there are no large ones remaining each time
I cant figure out what or where LC is holding in memory or where it is holding it, any ideas?
Many Thanks
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Freeing Memory
Hi Richmond
Thank you for the swift reply, flush doesnt appear to be in the dictionary.
Many Thanks
Thank you for the swift reply, flush doesnt appear to be in the dictionary.
Many Thanks
Re: Freeing Memory
'flushEvents' is in the dictionary, it should show up when you search for 'flush', I'm not totally sure that would help in this case, but I could be wrong.
Just a thought, are you using 'open printing to PDF' and then using 'close printing' once the PDF is sent to the printer?
If you are not closing the print routine each time I could see that eating up memory, although I haven't tested it personally
Paul

If you are not closing the print routine each time I could see that eating up memory, although I haven't tested it personally

Paul
-
- VIP Livecode Opensource Backer
- Posts: 10050
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Freeing Memory
For some operations LC will free up memory at idle. If that's at the heart of what you're seeing there, you might consider breaking your handler's loop into something that can use a timer. Total throughput time should be nearly the same, but it may provide just enough of an idle break to clean up the memory hooks to completed PDFs.
Thinking about this further, a simpler option might be to try adding this in your loop:
If we're lucky that may surrender enough time back to the OS to clean up the PDF load for the next iteration.
Let us know how that works out.
Thinking about this further, a simpler option might be to try adding this in your loop:
Code: Select all
wait 10 millisecs with messages
Let us know how that works out.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Freeing Memory
Hi Richard
Thank you,
The memory used by LC maintains even after the operation is complete…
- pdf printing started
- task manager disk space used by Livecode increases on each repeat when a pdf is printed
- pdf printing finishes
- LC sits their doing nothing but still displaying in task manager that it is using a lot of disk space
… if I then run the operation again, yet more disk space is added to LC, until eventually LC crashes.
I can’t think of any reason why LC, would still be using disc space after the operation completes.
Thank you,
The memory used by LC maintains even after the operation is complete…
- pdf printing started
- task manager disk space used by Livecode increases on each repeat when a pdf is printed
- pdf printing finishes
- LC sits their doing nothing but still displaying in task manager that it is using a lot of disk space
… if I then run the operation again, yet more disk space is added to LC, until eventually LC crashes.
I can’t think of any reason why LC, would still be using disc space after the operation completes.
-
- VIP Livecode Opensource Backer
- Posts: 10050
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Freeing Memory
Disc space or memory?
So you have a recipe we can run to reproduce this?
With a recipe stack, add that to a bug report and the team can usually address such issues quickly.
So you have a recipe we can run to reproduce this?
With a recipe stack, add that to a bug report and the team can usually address such issues quickly.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Freeing Memory
There are some reports of memory not being freed when printing to PDF and it looks like it is currently being looked at (awaiting test):
https://quality.livecode.com/show_bug.cgi?id=23088
Scroll to the bottom of the lenghty bug reports.
KInd regards
Bernd
https://quality.livecode.com/show_bug.cgi?id=23088
Scroll to the bottom of the lenghty bug reports.
KInd regards
Bernd
Re: Freeing Memory
Is this a Windows thing only?
Craig
Craig
-
- VIP Livecode Opensource Backer
- Posts: 10050
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Freeing Memory
Thank you for posting that link, Bernd.
That it how it's listed in the report.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn