RE: Memory Leak in C# Windows Service

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Vladimir,

With your database connections and datareaders you want to make sure
that they are being "closed" when you're done with them. So if you create
a rdr with the application block you need to make sure that you call
rdr.close().

Also if you happen to use any COM objects in your code you need to use
System.Runtime.InteropServices.Marshal.ReleaseComObject

to release the COM object rather than just setting it to null.

HTH
Brian Hman

"Vladimir" wrote:

> I created a windows service that performs a MSSQL2000 database analysis in a
> separate threads with a specified interval. And when running this service
> uses a lot of system memeory and it does release it after finishing it's
> jobs and starting to "sleep". I use there Microsoft.AplicationBlocks.Data
> libary to access database and I suppose the service caches the data since it
> performs all the next parcings at a moment unlike at the first time for 20
> minutes. Actually the service is working fine except memory leak, I have put
> null to every object, and made sure that Microsoft.AplicationBlocks.Data
> libary closes db connections.
>
> Does anybody know how can I make my service to release memory when it is
> finished it's job and how can I manage the ADO.NET caching?
>
> Thanks
>
> --
>
>
> - Vlad
>
>
>
.



Relevant Pages

  • Re: In FrontPage 2003 what is a thicket?
    ... | and database connections. ... | as good), the error, "Database Results Wizard Error ... | the file was part of a thicket and could not be changed. ...
    (microsoft.public.frontpage.extensions.windowsnt)
  • Re: aggregation class ideas?
    ... I also have database abstraction class that is ... database connections in your application, ... situation, the active record, table gateway, or data mapper patterns ... mapper pattern even in simple situations, ...
    (comp.lang.php)
  • In FrontPage 2003 what is a thicket?
    ... I was trouble shooting a Web for someone who was running active server pages ... and database connections. ... the file was part of a thicket and could not be changed. ...
    (microsoft.public.frontpage.extensions.windowsnt)
  • Re: How to improve database controls in ASP
    ... I'm not sure why this is ocurring, but here are some common issues... ... Be sure that post SQL query, your database connections close when they ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How to improve database controls in ASP
    ... Be sure that post SQL query, your database connections close when they ... For SQL queries that require data retrieval, as only show me the data, ...
    (microsoft.public.dotnet.framework.aspnet)