473,769 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4035
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******@discu ssions.microsof t.com> wrote in message
news:CE******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
news:CE******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
news:76******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
news:CE******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
news:76******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
news:CE******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
news:C2******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
news:76******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
>> news:CE******** *************** ***********@mic rosoft.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 RemotingConfigu ration.Configur e("Client.exe.c onfig") 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******@discu ssions.microsof t.com> wrote in message
news:C2******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
news:76******** *************** ***********@mic rosoft.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******@discu ssions.microsof t.com> wrote in message
>> news:CE******** *************** ***********@mic rosoft.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
565
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 installed on Windows 2003 Server, the application works well, and the COM object can be called just as it's meant to be. The service is however running under the IWAM account (I know strange account to run a service). However, after a while (from...
3
1639
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 classes. The classes 'run' themselves using several threads and only stop when the form is closed. Now I've used these worker classes in the service application. When I try to run my service manually, I am given a message that the service stopped...
1
3388
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 doesn't work (sorry, can't be more descriptive.. no errors, but no results). We've even taken the exact Windows Service project and put code in main() to instantiate the service and call OnStart() instead of going through the service base class. ...
2
2818
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 web service. The web service will be calling the windows service to get information relating to the printers installed on this machine. J
8
7602
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 wee hours of the morning). From the time the service starts to the first time it hits the database its memory consumption is about 6.9MB which is a figure I can live with. However, after it hits the database for the first time its memory jumps to...
10
4986
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 Instance needs to run in its own process. My current approach to this is to put all the logic into a separate "Worker" assembly and install it into the GAC. I'm then going to create Multiple Windows Services (i.e. MyService1, MyService2 etc..)...
4
3355
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. Has someone any idea why this happens? Anyway to solve this problem I thought to stop the service and start it programmatically when it’s “Mem Usage” is too big. Is it possible?
1
2232
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 start several instances of the same application, like multiple Windows Calculators for instance. We are experiencing difficulties starting applications after a certain number have been started. We changed our app to work as a Console...
3
7057
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 run application remotely and retrieve grid and form data in some way without accessing directly to database server? Web Services is being used for this purpose I think, Which methods must be used for this ?
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10212
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3962
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.