Garbage Collection – Memory Management in Blue Prism -by Abhinav Kumar

Garbage Collection

The concept of “garbage collection” is that the operating system will periodically (during “’free time”) reclaim memory which has been designated as available to be recovered – that is, memory which is no longer being used to store information required by running applications.

Garbage collection is essentially the opposite of manual memory management, which requires the programmer to specify which objects to deallocate and return to the memory system. However, many systems use a combination of approaches, including other techniques such as stack allocation and region inference. Like other memory management techniques, garbage collection may take a significant proportion of total processing time in a program and, as a result, can have significant influence on performance. With good implementations and with enough memory, depending on application, garbage collection can be faster than manual memory management, while the opposite can also be true and has often been the case in the past with sub-optimal GC algorithms.

How it is handled in Blue Prism:

Blue Prism retains data which has been created within it until the “automate.exe” process is closed down. In order to reclaim memory which a data item or collection containing run time data (Current values) is occupying whilst the Blue Prism process is running.

It is particularly helpful in processes dealing with multiple excel file reading and playing around with large number of data.

An example may be, when you are running on low RAM (<4GB) and doing excel based work, you get “System Out of Memory” exception causing Automate.exe to crash and stop.

In such cases, It’s better to run the garbage collector in every transaction just to free up memory so that the crashing may be handled.

The following strategies can be employed to attempt to force the underlying operating system to recover unused memory, and therefore make it available to Blue Prism again.

Note: The concept of garbage collection is a complex one, and the following information is a simplification of the underlying decision-making which the operating system is doing. There is no guarantee that the operating system will free up memory simply because these tactics have been employed, as this is outside of the control of any specific application.

Forcing garbage collection

Blue Prism can use .NET code functions in a Code Stage. One useful function relating to garbage collection is the GC.Collect() function. This requests that the operating system recover memory marked for collection as soon as possible. To use this function create a Code Stage in an Object and then publish the page as a Business Object action which can then be called from within a Process.

Download the Utility here.

If you are unable to download the Utility, Please email us  at, we will share it with you.

Else you may also go to our FB group and find the utility in files section.

Please remember, that it’s not the ultimate solution and there may be some other options available. However, this did the trick for me.

Please follow and like us: