How to save system memory precautions at the time of development

Hi guys
Hope you are doing well I have question about memory problem i just need to ask how to save memory and what precaution need to follow to make robust code at the time of development so that code should not face any memory or other problem.

1 Like

Hey @Aleem_Khan !! Read the answer I gave in this thread, it fits perfectly with your question! Any additional questions, just send it here!

Hope this helps!

Hi

Have a view on the below checklists for managing memory space when developing a project and even after deploying a project

  1. First the files that bot processes has to be managed properly
    Say you have an input file and a temp file and a output file
    If all the files are placed in a LOCAL DRIVE then bot has to be designed in a way to delete all these files either at the start of the process execution or at the end of the execution

If these files are kept in shared drive for other users referral then it’s completely fine
No need to delete

  1. Whenever you are running a bot in a server it doesn’t rely only on files for memory management but also on applications been used

So make sure you have closed all the application once it is been used
This also has to be destined along the workflow

  1. Finally to take it advanced we can use garbage collector (GC) which serves as an automatic memory manager. The garbage collector manages the allocation and release of memory for an application. For developers working with managed code, this means that you don’t have to write code to perform memory management tasks. Automatic memory management can eliminate common problems, such as forgetting to free an object and causing a memory leak or attempting to access memory for an object that’s already been freed.

Inside the Invoke code Activity . you can use like this

GC.Collect()
GC.WaitForPendingFinalizers()
GC.Collect()

Here is the sample :
MemoryLeaks.zip (12.0 KB)

Hope this would help you

Cheers @Aleem_Khan

2 Likes

Can you please help me learn how to use GC any learning video or document please share.

1 Like

@Aleem_Khan

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.