473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Windows service memory problem

We are having issues with our windows services using memory and never
releasing it. We have one service that has a file watcher which takes an xml
file, inserts some records into a database, and creates a bunch of PDFs with
Crystal Reports. Another service is a remote object which serves as our data
access component -- basically it just executes stored procedures and returns
datasets. If you watch the services in task manager, you can see the memory
usage increase as it goes through whatever process (which I would expect),
once the process is over though, the memory usage does not decrease.
Eventually, we will get an out of memory exception because the service has
reached its limit. We have dissected the code 20 different ways to Sunday
and cannot figure out what is wrong. Is the memory in a service controlled
differently that other objects? Thanks for any help.
May 1 '06 #1
7 4016
Are you by chance using large byte arrays? (i.e. reading/writing to streams)

If so they will be "Large Objects" and managed differently than normal
objects.

This is a very common confusion with a memory leak.

Use a profiler and see what kind of memory you are using (Large Objects, and
the varying generations)

Cheers,

Greg

"HeatherS" <He******@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.com...
We are having issues with our windows services using memory and never
releasing it. We have one service that has a file watcher which takes an
xml
file, inserts some records into a database, and creates a bunch of PDFs
with
Crystal Reports. Another service is a remote object which serves as our
data
access component -- basically it just executes stored procedures and
returns
datasets. If you watch the services in task manager, you can see the
memory
usage increase as it goes through whatever process (which I would expect),
once the process is over though, the memory usage does not decrease.
Eventually, we will get an out of memory exception because the service has
reached its limit. We have dissected the code 20 different ways to Sunday
and cannot figure out what is wrong. Is the memory in a service
controlled
differently that other objects? Thanks for any help.

May 1 '06 #2
Thanks for your reply.

We're not using large byte arrays, but we are passing a dataset back which,
of course, is probably a "Large Object". If they are large objects, how do I
reclaim that memory if dispose and GC is not getting it back? My issue isn't
that it is using memory but that it won't give it up when its done.

"Greg Young" wrote:
Are you by chance using large byte arrays? (i.e. reading/writing to streams)

If so they will be "Large Objects" and managed differently than normal
objects.

This is a very common confusion with a memory leak.

Use a profiler and see what kind of memory you are using (Large Objects, and
the varying generations)

Cheers,

Greg

"HeatherS" <He******@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.com...
We are having issues with our windows services using memory and never
releasing it. We have one service that has a file watcher which takes an
xml
file, inserts some records into a database, and creates a bunch of PDFs
with
Crystal Reports. Another service is a remote object which serves as our
data
access component -- basically it just executes stored procedures and
returns
datasets. If you watch the services in task manager, you can see the
memory
usage increase as it goes through whatever process (which I would expect),
once the process is over though, the memory usage does not decrease.
Eventually, we will get an out of memory exception because the service has
reached its limit. We have dissected the code 20 different ways to Sunday
and cannot figure out what is wrong. Is the memory in a service
controlled
differently that other objects? Thanks for any help.


May 2 '06 #3
The dataset is probably not the problem, it is actually an aggregation of
many small objects.

Have you profiled your application?

Cheers,

Greg

"HeatherS" <He******@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
Thanks for your reply.

We're not using large byte arrays, but we are passing a dataset back
which,
of course, is probably a "Large Object". If they are large objects, how
do I
reclaim that memory if dispose and GC is not getting it back? My issue
isn't
that it is using memory but that it won't give it up when its done.

"Greg Young" wrote:
Are you by chance using large byte arrays? (i.e. reading/writing to
streams)

If so they will be "Large Objects" and managed differently than normal
objects.

This is a very common confusion with a memory leak.

Use a profiler and see what kind of memory you are using (Large Objects,
and
the varying generations)

Cheers,

Greg

"HeatherS" <He******@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.com...
> We are having issues with our windows services using memory and never
> releasing it. We have one service that has a file watcher which takes
> an
> xml
> file, inserts some records into a database, and creates a bunch of PDFs
> with
> Crystal Reports. Another service is a remote object which serves as
> our
> data
> access component -- basically it just executes stored procedures and
> returns
> datasets. If you watch the services in task manager, you can see the
> memory
> usage increase as it goes through whatever process (which I would
> expect),
> once the process is over though, the memory usage does not decrease.
> Eventually, we will get an out of memory exception because the service
> has
> reached its limit. We have dissected the code 20 different ways to
> Sunday
> and cannot figure out what is wrong. Is the memory in a service
> controlled
> differently that other objects? Thanks for any help.


May 2 '06 #4
Ok, here's where I start having trouble. When you say profiled are you
referring to all of the counters available with the performance monitor? If
so, which counters would be relevant? I can see the service has the heap
size for Gen 0, 1, 2, and large objects ever increasing but not sure what to
do with that? Thanks again for any help.

"Greg Young" wrote:
The dataset is probably not the problem, it is actually an aggregation of
many small objects.

Have you profiled your application?

Cheers,

Greg

"HeatherS" <He******@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
Thanks for your reply.

We're not using large byte arrays, but we are passing a dataset back
which,
of course, is probably a "Large Object". If they are large objects, how
do I
reclaim that memory if dispose and GC is not getting it back? My issue
isn't
that it is using memory but that it won't give it up when its done.

"Greg Young" wrote:
Are you by chance using large byte arrays? (i.e. reading/writing to
streams)

If so they will be "Large Objects" and managed differently than normal
objects.

This is a very common confusion with a memory leak.

Use a profiler and see what kind of memory you are using (Large Objects,
and
the varying generations)

Cheers,

Greg

"HeatherS" <He******@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.com...
> We are having issues with our windows services using memory and never
> releasing it. We have one service that has a file watcher which takes
> an
> xml
> file, inserts some records into a database, and creates a bunch of PDFs
> with
> Crystal Reports. Another service is a remote object which serves as
> our
> data
> access component -- basically it just executes stored procedures and
> returns
> datasets. If you watch the services in task manager, you can see the
> memory
> usage increase as it goes through whatever process (which I would
> expect),
> once the process is over though, the memory usage does not decrease.
> Eventually, we will get an out of memory exception because the service
> has
> reached its limit. We have dissected the code 20 different ways to
> Sunday
> and cannot figure out what is wrong. Is the memory in a service
> controlled
> differently that other objects? Thanks for any help.


May 2 '06 #5
If large objects is increasing that is your problem ...

Your remote component ... is it a webservice? remoting?

Cheers,

Greg

"HeatherS" <He******@discussions.microsoft.com> wrote in message
news:C2**********************************@microsof t.com...
Ok, here's where I start having trouble. When you say profiled are you
referring to all of the counters available with the performance monitor?
If
so, which counters would be relevant? I can see the service has the heap
size for Gen 0, 1, 2, and large objects ever increasing but not sure what
to
do with that? Thanks again for any help.

"Greg Young" wrote:
The dataset is probably not the problem, it is actually an aggregation of
many small objects.

Have you profiled your application?

Cheers,

Greg

"HeatherS" <He******@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
> Thanks for your reply.
>
> We're not using large byte arrays, but we are passing a dataset back
> which,
> of course, is probably a "Large Object". If they are large objects,
> how
> do I
> reclaim that memory if dispose and GC is not getting it back? My issue
> isn't
> that it is using memory but that it won't give it up when its done.
>
> "Greg Young" wrote:
>
>> Are you by chance using large byte arrays? (i.e. reading/writing to
>> streams)
>>
>> If so they will be "Large Objects" and managed differently than normal
>> objects.
>>
>> This is a very common confusion with a memory leak.
>>
>> Use a profiler and see what kind of memory you are using (Large
>> Objects,
>> and
>> the varying generations)
>>
>> Cheers,
>>
>> Greg
>>
>> "HeatherS" <He******@discussions.microsoft.com> wrote in message
>> news:CE**********************************@microsof t.com...
>> > We are having issues with our windows services using memory and
>> > never
>> > releasing it. We have one service that has a file watcher which
>> > takes
>> > an
>> > xml
>> > file, inserts some records into a database, and creates a bunch of
>> > PDFs
>> > with
>> > Crystal Reports. Another service is a remote object which serves as
>> > our
>> > data
>> > access component -- basically it just executes stored procedures and
>> > returns
>> > datasets. If you watch the services in task manager, you can see
>> > the
>> > memory
>> > usage increase as it goes through whatever process (which I would
>> > expect),
>> > once the process is over though, the memory usage does not decrease.
>> > Eventually, we will get an out of memory exception because the
>> > service
>> > has
>> > reached its limit. We have dissected the code 20 different ways to
>> > Sunday
>> > and cannot figure out what is wrong. Is the memory in a service
>> > controlled
>> > differently that other objects? Thanks for any help.
>>
>>
>>


May 2 '06 #6
Actually, I am pretty sure we solved it. I was so busy focusing on the class
that the remoting service exposed that I didn't pay attention to the service
itself. I was reading a post somewhere about a memory running amok if you
used RemotingConfiguration.Configure("Client.exe.config ") in the service, we
don't do that, but I thought maybe global variables would do the same. So I
checked and the code was written with the port numbers being held in global
variables (not sure why but whatever), so I cleaned those up made them local
to a procedure and removed some code from the constructor for the service and
viola, it seems to be working. We haven't put it in produciton yet, but when
we tax it in Dev and Beta all is well. Thanks for your help.
"Greg Young" wrote:
If large objects is increasing that is your problem ...

Your remote component ... is it a webservice? remoting?

Cheers,

Greg

"HeatherS" <He******@discussions.microsoft.com> wrote in message
news:C2**********************************@microsof t.com...
Ok, here's where I start having trouble. When you say profiled are you
referring to all of the counters available with the performance monitor?
If
so, which counters would be relevant? I can see the service has the heap
size for Gen 0, 1, 2, and large objects ever increasing but not sure what
to
do with that? Thanks again for any help.

"Greg Young" wrote:
The dataset is probably not the problem, it is actually an aggregation of
many small objects.

Have you profiled your application?

Cheers,

Greg

"HeatherS" <He******@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
> Thanks for your reply.
>
> We're not using large byte arrays, but we are passing a dataset back
> which,
> of course, is probably a "Large Object". If they are large objects,
> how
> do I
> reclaim that memory if dispose and GC is not getting it back? My issue
> isn't
> that it is using memory but that it won't give it up when its done.
>
> "Greg Young" wrote:
>
>> Are you by chance using large byte arrays? (i.e. reading/writing to
>> streams)
>>
>> If so they will be "Large Objects" and managed differently than normal
>> objects.
>>
>> This is a very common confusion with a memory leak.
>>
>> Use a profiler and see what kind of memory you are using (Large
>> Objects,
>> and
>> the varying generations)
>>
>> Cheers,
>>
>> Greg
>>
>> "HeatherS" <He******@discussions.microsoft.com> wrote in message
>> news:CE**********************************@microsof t.com...
>> > We are having issues with our windows services using memory and
>> > never
>> > releasing it. We have one service that has a file watcher which
>> > takes
>> > an
>> > xml
>> > file, inserts some records into a database, and creates a bunch of
>> > PDFs
>> > with
>> > Crystal Reports. Another service is a remote object which serves as
>> > our
>> > data
>> > access component -- basically it just executes stored procedures and
>> > returns
>> > datasets. If you watch the services in task manager, you can see
>> > the
>> > memory
>> > usage increase as it goes through whatever process (which I would
>> > expect),
>> > once the process is over though, the memory usage does not decrease.
>> > Eventually, we will get an out of memory exception because the
>> > service
>> > has
>> > reached its limit. We have dissected the code 20 different ways to
>> > Sunday
>> > and cannot figure out what is wrong. Is the memory in a service
>> > controlled
>> > differently that other objects? Thanks for any help.
>>
>>
>>


May 5 '06 #7
Hi there,

there are also some memory leaks around Crystal. I've crossed the same
problem, so you might be interested on this:
http://www.arquitecturadesoftware.or...05/23/328.aspx

hope it helps
HB

May 24 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Martijn Remmen | last post by:
I have developed a service which exposes a COM object. This service is running perfect on Windows 2000 Server and Windows 2000 Professional under the SYSTEM account. When the service is...
3
by: Claire | last post by:
Sorry for such a daft question. Ive been following some tutorials on creating windows services. Ive not done them before. In my original debuggable windows form application, I create my worker...
1
by: Samuel R. Neff | last post by:
We're using a 3rd party C DLL in a project that we don't have source for. When we call the DLL from a console app everything works fine. However, when we call it from a Windows Service, the DLL...
2
by: J | last post by:
Hello, What is the best/easiest way to setup interprocess communication between a windows service and a webservice? The windows service will be running on the same machine that is hosting the...
8
by: nautonnier | last post by:
I know my problem has been discussed ad nauseum but I still don't get it so please bear with me. I have written a service which performs some work against a database once a day (usually in the...
10
by: John | last post by:
I currently have a Windows Service that runs Transactions that are very Processor/Memory Intensive. I have a requirement to deploy multiple instances of the Web service on the Same server. Each...
4
by: Niron kag | last post by:
Hi, I have a windows service, which is currently installed, on my local computer. The problem is that when I look at the task manager, I see that the “Mem Usage”, become bigger and bigger....
1
by: mikelujan | last post by:
Hi, Our application starts an external application using System.Diagnostics.Process class and the Start() method, as per code snippet below. This application run as a Windows service, and must...
3
by: Sylvie | last post by:
My Windows Application has two forms, one form contains a grid (lets say Stock Listing), and the other is a form of one stock, contains some edit boxes for one stock's fields.. Is it possible to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.