Windows Vista Forums

System.OutOfMemoryException thrown by System.Threading.Thread.Slee
  1. #1


    Max Vernon Guest

    System.OutOfMemoryException thrown by System.Threading.Thread.Slee

    I have built some software that uses a variable number of threads. If I use
    about 400 or so threads, the code runs fine, however when I use above about
    800 or so I get System.OutOfMemoryException in various places such as
    System.Threading.Thread.Sleep(0)

    I need to use a relatively large number of threads since each thread access
    a Web Service with inherent processing delays at the server end. Each thread
    basically starts and then waits for the io completion before returning
    results to the main application.

    According to Windows Task Manager, my app is using 200M of memory. VM size
    is just shy of 1GB. Task Manager reports I have 2.6GB available RAM (I'm not
    using a pagefile at all). Clearly, I'm not out of memory, so something else
    must be the root cause of this issue. Any ideas?

    I'm using:

    Visual Studio Pro 2008 Visual Basic
    App is configured to use .Net 3.5
    Machine is Windows XP x64 Pro with 8GB RAM




      My System SpecsSystem Spec

  2. #2


    Bjarte Skogøy Guest

    Re: System.OutOfMemoryException thrown by System.Threading.Thread.Slee

    Hi,
    Maybe Sleep(1) would solve some problems? Check out this article:
    http://www.bluebytesoftware.com/blog...4b8f3d1a1.aspx

    regards
    Bjarte Skogøy


    "Max Vernon" <Max Vernon@xxxxxx> skrev i nyhetsmeldingen:
    68786438-3514-40DC-86EB-EAAE8CD77C58@xxxxxx ...

    > I have built some software that uses a variable number of threads. If I
    > use
    > about 400 or so threads, the code runs fine, however when I use above
    > about
    > 800 or so I get System.OutOfMemoryException in various places such as
    > System.Threading.Thread.Sleep(0)
    >
    > I need to use a relatively large number of threads since each thread
    > access
    > a Web Service with inherent processing delays at the server end. Each
    > thread
    > basically starts and then waits for the io completion before returning
    > results to the main application.
    >
    > According to Windows Task Manager, my app is using 200M of memory. VM
    > size
    > is just shy of 1GB. Task Manager reports I have 2.6GB available RAM (I'm
    > not
    > using a pagefile at all). Clearly, I'm not out of memory, so something
    > else
    > must be the root cause of this issue. Any ideas?
    >
    > I'm using:
    >
    > Visual Studio Pro 2008 Visual Basic
    > App is configured to use .Net 3.5
    > Machine is Windows XP x64 Pro with 8GB RAM
    >

      My System SpecsSystem Spec

System.OutOfMemoryException thrown by System.Threading.Thread.Slee problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
import-csv giving System.OutOfMemoryException Jeffery Jensen PowerShell 2 07 Apr 2009
Help. Getting System.Web.HttpUnhandledException' was thrown. aboutjav.com .NET General 0 29 Apr 2008
System.OutOfMemoryException Robertico PowerShell 14 27 Apr 2008
Help: System.Threading.Timer doesn't work! Curious .NET General 1 23 Apr 2008
start System.Threading.Thread Selko PowerShell 7 30 Aug 2007