473,856 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Memory Leak with .NET 2.0 - any suggestions, or help?

I have encountered a memory leak in out application using .NET 2.0
while using our owner drawn controls. There are two instances I have
found when checking the memory using .NET Memory Profiler from SciTech,
both led to WeakReference leaks:

Graphics.DrawIc onUnstretched()
the call stack is as follows:
Icon.DrawUnstre tched(...);
WindowsGraphics .FromGraphics
WindowsGraphics .FromHdc();
DeviceContext.F romHdc()
DeviceContext.c tor()
DeviceContexts. AddDeviceContex t()
ClientUtils.Wea kRefCollection. Add()
ClientUtils.Wea kRefCollection. CreateWeakRefOb ject()
ClientUtils.Wea kRefCollection. WeakRefObject.. ctor
Create a SolidBrush or a Pen had led to following call stack:
SolidBrush.ctor (Color)
SystemColorTrac ker.Add()
The created icon and the brush/pen are in a using block and should have
been released. I can not say for sure that this was previously working
with the .NET 1.1 Version but I have not seen this leak before and I
have done a lot of memory testing. The owner drawn controls are used
for a toolbar which is redrawn quite frequently as usual so the leak is
really serial.

Is there any MVP around that knows about this problem? I have seen only
one report mensioning the SystemColorTrac ker bug but there was no
positiv reply to it.

If there is no fix for it how good are the chances that it will be
fixed soon, lets say in the next 4 month?

We encountered yesterday another odd behaviour with our application
which was running several hours on a XP machine and is maybe related to
it: The application stopped drawing the controls and made a red "X"
instead. Our log file showed that when the application was trying to
create an icon it created an BufferedGraphic sContext exception, the
german error text to it is "BufferedGraphi csContext kann nicht entfernt
werden, da momentan ein Puffervorgang läuft." The Taskmanager showed
that the app was using over 9000! GDI-Objects - normally there are only
about 500.

Hope that I have provided enough informations to find someone out
therer who can help

Yours
Don

Dec 19 '06 #1
1 2983
New Year - new hope ....

.... that someone reads this message and has an idea or solution to the
problem. As long as you are using build in controls this behaviour
might not happen but if you want to create a cool looking application
you are lost, aren't you?

Ciao
Dante

Jan 2 '07 #2

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

Similar topics

3
4677
by: Jeremy Lemaire | last post by:
Hello, I am working on cross platform code that is displaying a huge memory leak when compiled on 11.00 HPUX using the aCC -AA flag. It is not leaking on NT, LINUX, Solaris, or HPUX without the -AA flag. In another news group I came across some interesting (ok scarey) information regarding memory leaks in the STL list<...> container. I have compiled and executed the following code and verified that this does in fact leak on my system.
10
1948
by: Jonathan Ames | last post by:
Moving to C++ from Java, I'm still confused by some aspects of memory cleanup operations. For example, let's say I have a class MovingObject which maintains a pointer to another class MovementAlgorithm. MovingObject has a method SetMovementAlgorithm(MovementAlgorithm* movementAlgorithm) if the body of this method reads
6
2573
by: Scott Niu | last post by:
Hi, I have this following simple c++ program, it will produce memory leak ( see what I did below ). My observation also showed that: There will be a mem leak when all the 3 conditions are true: 1. CallControlData does not provide a operator= 2. INUserHandle's operator= returns a object instead of a reference 3. Use CC -g main_leak.C instead of CC main_leak.C to compile. You change any of the above condition, there will be NO mem leak.
1
1909
by: mark.engelberg | last post by:
I am having trouble identifying the source of a memory leak in a Windows Python program. The basic gist is as follows: 1. Generate a directed graph (approx. 1000 nodes). 2. Write the graph to a file. 3. Use the os.system command to invoke another program which processes the graph file (graphViz), and generates a gif image of the graph. 4. Use another os.system command to delete the intermediate file, which is no longer needed. 5. Append...
4
6099
by: Don Nell | last post by:
Hello Why is there a memory leak when this code is executed. for(;;) { ManagementScope scope = new ManagementScope(); scope.Options.Username="username"; scope.Options.Password="password"; scope.Path.Path=@"\\pc\root\cimv2";
9
425
by: Anton | last post by:
{Willy Skjveland} Hi, how can I trace a Memory leak in aspnet_wp.exe? {Rheena} One moment please while I search it for you. It may take me a few moments {Willy Skjveland} I need to find out which application and which dll and asmx page that cause the problem. {Rheena} May I know what operating system you are using?
2
2422
by: Loic | last post by:
A Memory leak in the dotnet UserControl ? Hi All, I’ve tried to use the following “Host Secure, Lightweight Client-Side Controls in Microsoft Internet Explorer” sample (I’d like to use a C# User Control for a project): http://msdn.microsoft.com/msdnmag/issues/02/01/userctrl/ Everything seams working fine (the control is displayed, localhost is fully trusted, …), but using the Windows Task Manager, each time I’m reloading...
7
4084
by: Tom Davis | last post by:
I am having a problem where a long-running function will cause a memory leak / balloon for reasons I cannot figure out. Essentially, I loop through a directory of pickled files, load them, and run some other functions on them. In every case, each function uses only local variables and I even made sure to use `del` on each variable at the end of the loop. However, as the loop progresses the amount of memory used steadily increases. I...
22
9377
by: Peter | last post by:
I am using VS2008. I have a Windows Service application which creates Crystal Reports. This is a multi theaded application which can run several reports at one time. My problem - there is a memory leak someplace. I can not detect the memory leak by running several reports by hand, but when I run tha app as a servrice and process few hundred reports there is significant memory leak. The application can consume over 1GB of memory where it...
0
9918
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9763
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
11060
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
10389
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...
0
9532
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7097
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
5762
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...
0
5959
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4175
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.