简体   繁体   中英

Quartz.net Scheduler memory leak

I have a scheduler windows service running in the server with different schedule time each job.

There are two problems that came up:

  1. During the week the service is running correct doing all the jobs that have to do, but in certain time it throw an OutofMemoryException in the log file each time the jobs run.

  2. In the sever that is running this service of scheduler, the task manager is just increasing the memory and not cleaning it. To clean the memory the scheduler service is restart.

I don´t know if there is a way to solve it this problems by code.

Thanks in advice

Quartz should clean after itself. If you implemented a custom JobFactory be sure to Release your Jobs after execution.

I am writing here as I have found the solution for the mentioned problem. There is a project available on GitHub which have the sample code but you may need to adjust that according to your need which have all the necessary things to setup AutoFac with Quartz jobs. Here is the link .

This include two main features:

Autofac.Extras.Quartz creates nested litefime scope for each Quartz Job. Nested scope is disposed after job execution has been completed.

This allows to have single instance per job execution as well as deterministic disposal of resources.

Certainly this will help some other guys who are facing the same issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM