Solved

COM+ memory problems

Posted on 2002-07-25
3
536 Views
Last Modified: 2013-12-04
Hi,

I write an application that uses COM+ to access the application layer on a server. The server is written using MSVC 6 and ATL.

My Problem is that when the server is heavily loaded I get a very high memory consumtion of the dllhost.exe that is running my COM-Server. That would be no problem, but when all objects are released again, the memory consumtion doesn't go down again.

What could be the cause of that and what how can I release that memory again?

Thanks
Overmind
0
Comment
Question by:Acrklor
  • 2
3 Comments
 

Expert Comment

by:d2hilst
ID: 7190281
Hi,

This sounds a bit strange, can you please supply some more information? If you run your client for a while, can you
actually see the memory usage for the dllhost application go up? And if you bring the server down in this state (by shutting down the client), the memory is not returned to Windows?

I have worked quite a lot with COM/COM+ on Windows NT/2000 and my experience is that it is very unusual for Windows
NT/2000 to loose track of (memory) resources this way.

Is the client also a C++ application?

Are you developing on Windows 2000/XP/...?

Does the server application use other COM+ components?

Without knowing more in detail about your environment/applications, my best recommendation would be to ask you go through the memory allocation in both the server and client. In my programs memory allocation errors is by far the most common mistake (but that's me ;-)


Regards
/Stefan
0
 
LVL 2

Author Comment

by:Acrklor
ID: 7195549
Hi,

Both client and server are developed with MSVC 6 on Windows 2000 and the application uses no other COM+ components.

The memory loss seems to me like a kind of caching, here is a short example of the memory loss:
1.) wihtout any action dllhost takes about 4000k
2.) client logged on: dllhost.exe goes up to 6500k
3.) client starts module A: 12000k
4.) client ends module A: 11000k
5.) client starts module A: 12000k
6.) client ends module A: 11000k
7.) client starts module B: 13500k
8.) client starts module A: 14500k
9.) client end module B: 14000k
10.) client ends module A: 13000k
11.) client logged off: still 13000k

If I have started all functions I'm up to about 45000k, the problem is that the memory consumption still increases at this point (about 100-500k in modul), but not as fast as in the beginning. I'm not sure if every byte is freeed correctly ;-), but I'm sure it shouldn't be that much, every of our own objects is released.

thx
Acrklor
0
 

Accepted Solution

by:
d2hilst earned 350 total points
ID: 7200520
Hi Acrklor,

I'm not sure how to help you, but I write what I think based on your description and you might get an idea as to what causes the problem, ok? :-)

Step 1-2 is probably not a leak. By logging on, you mean that you create the COM object? If so, the dllhost increase in memory is most likely caused by dll:s that are needed by the COM system are loaded.

Step 2-3 is a big leap for starting a COM object, but it can be explained if the object uses some other stuff that needs a lot of memory and external dll-resources (for example a database connection). A bit more alarming is the fact that it is not returned when the COM object is destroyed (#11). I can think of 2 reasons as to why;

1. The object is not properly released.
How do you store your COM pointer (plain pointer, smart pointer...)? If you store it as a plain pointer, check the return value from Release (should be 0 to deallocate the object).  

2. The memory is allocated due to dll loads.
If the COM object actually uses a lot of dll resources, they can remain in memory after you destroy the COM object. You can test this by creating a new object after #11, i.e. reconnect/restart the test sequence. If the memory stays about the same after logon, everything is ok. If not, check the pointer release stuff again...

3-10; Starting and stopping the module, is probably caused by a leak. You wrote that you think it is possible that you may have one or two small leaks. If the module you are running is repeatingly running the same pattern many times, this can cause rather big leaks. The memory is allocated in chunks, and if you only return 99% of the used memory in your deallocation, the last 1% will cause big leaks (memory fragmentation; the chunks cannot be deallocated until all individual bytes are deallocated)

As is wrote above, I'm not sure this will help you, but it might give you an idea as to what's wrong.

Regards,

Stefan
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question