Hi Oleg,
Could you, please, advise the best practice for working with variables which hold big amounts of text at many iterations?
I often use variables to read text from a number of text files in a loop. I do this to find certain values or to replace strings of text in files. The problem I am facing is that sometimes, after several iterations, Robotask freezes and I have to kill it and re-start. Also, when this happens, log displays steps names with funny characters. And I noticed that this depends on the size of the files - the bigger the files the more often Robotask freezes. It suggests to me that memory is not getting freed up or reused between iterations, something gets stuck and accumulates. Which, in turn, tells me I am not using the variables correctly and efficiently.
What would you recommend to make sure only needed values stay in memory between iterations, but the rest gets removed from there?
I remember reading your advice on this or similar problem few years ago but cannot find it now.
Thank you.
Sincerely,
Lana
Freeing memory while working with variables which read through large amounts of text
Freeing memory while working with variables which read through large amounts of text
- Attachments
-
- image.png (8.3 KiB) Viewed 8570 times
Re: Freeing memory while working with variables which read through large amounts of text
To free memory from stored large data, simply assign an empty string to the variable. The empty string will replace the large text in the variable.
Use Set Variable action
You can also delete unnecessary variables: Remove Variable action
I also strongly recommend using local variables (not global variables). All local variables will be freed after the task is finished
Answer a couple questions:
What edition of RoboTask do you use: 32-bit or 64-bit?
What is the amount of RAM on your computer?
Use Set Variable action
You can also delete unnecessary variables: Remove Variable action
I also strongly recommend using local variables (not global variables). All local variables will be freed after the task is finished
Answer a couple questions:
What edition of RoboTask do you use: 32-bit or 64-bit?
What is the amount of RAM on your computer?
Oleg Yershov
Re: Freeing memory while working with variables which read through large amounts of text
Thank you for the advice.
Because of our company security policy, Robotask x64 is installed on a remote server along with many other programs and many people have access to the server, which we all access from our laptops via remote desktop. This setup also allows access to locations and files not accessible externally. Robotask is used mostly by me and sometimes by two other colleagues, but other programs on that server get accessed a lot by many people. So, firstly, I don't know how much RAM the server has to begin with, and secondly, it is impossible to tell how much of it is free for my tasks to use at any given time. This is another reason why there is no consistency in the task successful or unsuccessful completion, not just the size of data placed in variables.
I do use only local variables - they are listed as local and the list of global user variables is empty. Assigning an empty string might help at the end of use of the variable within the task, but not at the end of each iteration in a loop, because it immediately gets overwritten with a new value at the start of the next iteration. Also, it so happens that these variables are used pretty much until the end of the task, so, hopefully, they no longer use any memory once the task is completed.
But I am curious if removing variables at the end of each iteration and re-creating them at the start of the next would help me. I'll try it.
Sincerely,
Lana
Because of our company security policy, Robotask x64 is installed on a remote server along with many other programs and many people have access to the server, which we all access from our laptops via remote desktop. This setup also allows access to locations and files not accessible externally. Robotask is used mostly by me and sometimes by two other colleagues, but other programs on that server get accessed a lot by many people. So, firstly, I don't know how much RAM the server has to begin with, and secondly, it is impossible to tell how much of it is free for my tasks to use at any given time. This is another reason why there is no consistency in the task successful or unsuccessful completion, not just the size of data placed in variables.
I do use only local variables - they are listed as local and the list of global user variables is empty. Assigning an empty string might help at the end of use of the variable within the task, but not at the end of each iteration in a loop, because it immediately gets overwritten with a new value at the start of the next iteration. Also, it so happens that these variables are used pretty much until the end of the task, so, hopefully, they no longer use any memory once the task is completed.
But I am curious if removing variables at the end of each iteration and re-creating them at the start of the next would help me. I'll try it.
Sincerely,
Lana
Re: Freeing memory while working with variables which read through large amounts of text
Just to update, I used 'Remove variable' before the very end of the loop on several variables which hold the largest amounts of text and this 1) made the task faster, 2) fixed some intermittent problems causes for which I could not understand because they were not always reproducible, 3) made the task more fail-resistant.
So, from now on I will make it a habit to kill all variables which work with big chunks of text at the end of iteration.
So, from now on I will make it a habit to kill all variables which work with big chunks of text at the end of iteration.