By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,318 Members | 2,107 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,318 IT Pros & Developers. It's quick & easy.

Windows service memory problem

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.