I have a timer job that runs every night at midnight.

The first part of the timer job is to iterate through every single site in a particular site collection (there are many).

The second part of the timer job is to issue e-mails for each list item that was retrieved in the first part.

Both potentially rather taxing operations.

On one particular environment, the timer job doesn't work (i.e. no e-mails are sent/received), but has been proven on 3 other environments and behaves as expected.

In the ULS logs for the environment with the problem, I can see a lot of the following sorts of entries for this timer job:

An SPRequest object was reclaimed by the garbage collector instead of being explicitly freed. To avoid wasting system resources, dispose of this object...

Potentially excessive number of SPRequest objects (26) currently unreleased on thread 20.

An SPRequest object was not disposed before the end of this thread....this object will now be disposed.

Would you expect that such errors could cause the timer job to stop or fail to execute the 2nd part?

There are no other relevant exceptions in the logs to note.

I am now going to spend time refactoring the code to ensure all objects are disposed of correctly with using statements and run spdisposechecker anyway, but can I confidently say that this may just solve the issue?

PLEASE NOTE The server on which this timer job does not perform has significantly less resources than the other environments. It's processor and RAM are max'd out before even running the timer job so I'd imagine it has no tolerance for memory leaks or poorly disposed objects.

  • 1
    It might solve the issue. You say the timer job runs fine on all other machines - they should have the same dispose problem, hence it is less likely being the problem. You should first refactor (and add some logging) and see whether that solves your problem.
    – Dennis G
    Commented Jan 15, 2013 at 11:03
  • Sorry @moontear - I should've mentioned something rather important which I'll include in the OP now. Commented Jan 15, 2013 at 11:10
  • 1
    Oh, the Server is maxed out on RAM anyways - if your e-mail sending is resource intensive this of course could be your problem. SharePoint needs a lot of RAM, always give it enough.
    – Dennis G
    Commented Jan 15, 2013 at 13:19
  • Given the fact I have no control over the resource it's granted - I suppose I can only optimise my code and make the necessary disposal of objects. Thanks a lot @moontear Commented Jan 15, 2013 at 14:11

1 Answer 1


If the server is maxed out on RAM that is where your problem and many other problems might stem from.

You say yourself that the timer job is resource intensive - you will get weird problems if the RAM is maxed out. Your SharePoint objects should be properly disposed otherwise that would add to the size of the RAM of your w3wp threads on the computer.

First: Try to optimize your code with using. Then add more logging and see whether you can find out where the real problem lies. Any foreach over all items in a list is discouraged as it really is a resource hog. Isn't it feasible to use e.g. event receivers and run on each item?

Try to optimize your code first and see if that solves the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.