I am temporarily using a windows form app to host a background job server with an expectation of moving it to a windows service. But I’m concerned that there is a severe memory leak while the background server is running, even if it isn’t running any jobs. The memory hits a gigabyte in a few days.
I’m using autofac, and SQL Azure. I haven’t yet analysed the leak but I wondered if this a known issue with windows forms, and so I can expect it to go away when I move to a more permanent setup.
Many thanks for any help.
My code is below:
var storage = new SqlServerStorage(“ConnString”);
var options = new BackgroundJobServerOptions { ServerName = “xxx” };
_hangfireServer = new BackgroundJobServer(options, storage);
JobActivator.Current = new AutofacJobActivator(_autofacContainer);
_hangfireServer.Start();
JobStorage.Current = storage; // needed in order to use the job scheduling api.