473,396 Members | 1,970 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,396 software developers and data experts.

GDI Leaks Detection

Jurnero
32
Hello! Several times I had a problem with GDI-objects leak.
My colleagues helped me solve the problem. But I would like to ask for help! How are you searching this type of leak? What utilities or plugins for VS can help me?

Programming language: C++. Visual Studio
Nov 14 '18 #1
8 2952
weaknessforcats
9,208 Expert Mod 8TB
Are you using C or C++ ?

You use managed pointers aka smart pointers.

It's harder n C since you need to set up your own reference counters.

Then you create these objects using a function that increments the reference count.

You delete using a function that decrements the reference count and deletes the object if the count is zero.

In C++ it is handled using managed pointer objects which contain a reference to the object being managed.

In today's world you should never be using naked pointers anywhere.
Nov 14 '18 #2
Jurnero
32
Thanks for the answer.
Added details to the question
Programming language is C++/Visual Studio
Nov 15 '18 #3
weaknessforcats
9,208 Expert Mod 8TB
In this case study up on std::shared_ptr<> and its associates.

Be sure your GDI object ctor/dtor work correctly.

Depending upon whose GDI object you are using,like one written in C, you may need to embed the object in class object so there is ctor/dtor available.
Nov 15 '18 #4
Jurnero
32
Thank you for this clarification. I think it should be very helpful to me.
Nov 16 '18 #5
Maybe you need to spend more time studying the theory. Try reading several articles about the memory model in C ++. This will help you understand how memory is allocated.
Also, you can use GDI leak detection tools.
Nov 19 '18 #6
Jurnero
32
Perhaps you `re right. What books, articles do you recommend to reading? What tools do you mean?
Nov 20 '18 #7
I can advise such debugger as Deleaker. It works with GDI leaks.
Task Manager can show the presence of such leaks.
Dec 27 '18 #8
Jurnero
32
OldStory, thanks for the answer. I've heard good reviews about this debugger.
Jan 17 '19 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: __jakal__ | last post by:
Hello, Is there any good memory leak detection software for C++ available as a freeware... I had used purify but had to discontinue due to huge license fees... Also tried Sun workshop memory...
1
by: Spur | last post by:
Hi all, I implemented a memory allocation/deallocation class that logs all new/delete calls (overloaded) and remembers for each allocated block where it was allocated from (using a macro that...
7
by: mosaic | last post by:
Hi, all I really interested in how to check the memory leak of a program. Your smart guys, do you have excellent ideas that could share with me? Thank you. The following is my idea: In C...
0
by: Frank Lopez | last post by:
Does anyone know if Microsoft generated a whitepaper on this topic? Does anyone know what the solution is? (meaning, eliminate the leak problem -- I am seeing three memory leaks from...
8
by: kk_oop | last post by:
Hi. Any recommendations for memory leak detection tools for C++ running on Linux or Solaris? I'm interested in static (compile time) and runtime detection. It's for a large project. Thanks! ...
14
by: Ook | last post by:
I have a set<Item*that I use in a class, Item being one of my classes. In the destructor, I want to iterate through the set and remove the elements so there are no memory leaks. Is this the correct...
13
by: Ilias Lazaridis | last post by:
How to detect memory leaks of python programms, which run in an environment like this: * Suse Linux 9.3 * Apache * mod_python The problem occoured after some updates on the infrastructure....
10
by: Conrad Lender | last post by:
In a recent thread in this group, I said that in some cases object detection and feature tests weren't sufficient in the development of cross-browser applications, and that there were situations...
1
by: AndreaMelet | last post by:
Hi. I've tried using several tools to detect memory leaks (and also bottlenecks) in the C++ code I'm working on (platform: Windows). But our software is so large that none of them have been useful...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...

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.