Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc » Heap Leaks on Linux when migrating to new distro and newer UPP (Moved working app to new distro and upp-x11-src-8760 -- now heap leaks on exit)
Heap Leaks on Linux when migrating to new distro and newer UPP [message #45076] Thu, 27 August 2015 21:06 Go to next message
jfranks is currently offline  jfranks
Messages: 36
Registered: September 2014
Location: Houston, Texas
Member
We have a mature application that has been developed over the years and running
on upp-2007.1 and Ubuntu distro 9.10

We've decided to migrate to a new Linux distribution, i.e., Linux Mint 17.2
Also, we migrated to the UPP snap shot upp-x11-src-8760.

We have been successful at compiling and linking the application after making some
minor code changes to satisfy the new compile environment and UPP.

Everything works great, except when the application exits.
We get a dialog "Fatal error" with the message "Heap leaks detected!"
This goes away if we use the project flag USEMALLOC, but this is not
the solution since it only hides a memory usage issue.

Ordinarily, development of a new program would have caught this problem
early on. The problem is that we are now looking for a needle in the haystack
because of the size of the program. Where do we look?

We've tried various memory diagnostic tools to no avail.
They give false positives, and provided no useful information.
We've tried valgrind and a few others with no relief.

On the other hand, we believe there are memory handling issues in our
application that belong to us.
These have only been discovered (or caused by) the new environment:
new compiler, linker, libraries, and UPP library.

We've tried compiling the UPP examples and tutorials and they behave properly
on exit, as does the UPP theide.

What we are faced with now is dismembering the application piece at a time and
re-compile/re-link/re-run until we discover the offending code.

What we are asking is that someone may have a better solution or alternative
method for finding the real problem to our heap leak issue. Maybe there is
something we can do to obtain more information that we don't know about.
We would welcome any help or suggestions on this matter.
Please let us know what you think.

regards,
-jlf

Re: Heap Leaks on Linux when migrating to new distro and newer UPP [message #45077 is a reply to message #45076] Thu, 27 August 2015 21:52 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi jfranks,

See this message: http://www.ultimatepp.org/forums/index.php?t=msg&th=3285 &goto=14822&#msg_14822

First, if you get consistent values for --memory-breakpoint when running the application multiple times, then you can just add that as a parameter when running in debugger and it will show you where the offending piece of memmory was allocated.

Second method is to add MemmoryIgnoreLeaksBegin/End pairs around various parts of your application, until the warning stops. Then you know you found it... It is only slightly better than what you probably had in mind when you wrote about dismembering your application piece at a time, but it could save you some time and manual work Smile

Best regards,
Honza
Re: Heap Leaks on Linux when migrating to new distro and newer UPP [message #45258 is a reply to message #45077] Sat, 24 October 2015 17:45 Go to previous messageGo to next message
jfranks is currently offline  jfranks
Messages: 36
Registered: September 2014
Location: Houston, Texas
Member
We have made good progress at identifying and correcting the heap leaks in our application.
Additional tools were used in order to accomplish this, i.e., compile
with CLANG, and use asan.

The U++ snapshot that we are now using is upp-x11-src-9004.tar.gz

We are left with two heap leaks that we have yet to resolve.
Memory breakpoint 22748 is in our own application and we take ownership of that issue.

However, memory breakpoint 22235 is a real puzzle because it is almost exclusively is in U++ library.
Here is the log-file followed by a snapshot of the debugger call-stack:
=================
/home/svn/P101/trunk/Source/Build/upp.out/P101/CLANG.Debug.D ebug_Full.Gui.Mt.Newerupp.Noblitz.Shared.Stacktrace.X11/p101 21.10.2015 15:27:03, user: administrator

Heap leaks detected:

--memory-breakpoint__ 22748 : Memory at 0x0x7fd0c21bd9a0, size 0x58 = 88
+0 0x00007FD0C21BD9A0 60 D6 48 01 00 00 00 00 00 00 00 00 00 00 00 00 `.H.............
+16 0x00007FD0C21BD9B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
+32 0x00007FD0C21BD9C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
+48 0x00007FD0C21BD9D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

--memory-breakpoint__ 22235 : Memory at 0x0x7fd0ce6b7720, size 0x68 = 104
+0 0x00007FD0CE6B7720 10 72 48 01 00 00 00 00 00 01 65 65 46 72 65 65 .rH.......eeFree
+16 0x00007FD0CE6B7730 00 87 07 C2 D0 7F 00 00 14 00 00 00 01 00 00 00 ...............
+32 0x00007FD0CE6B7740 60 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 `...............
+48 0x00007FD0CE6B7750 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
****************** PANIC: Heap leaks detected!
====================

index.php?t=getfile&id=4851&private=0

Can someone help on this particular issue?
Re: Heap Leaks on Linux when migrating to new distro and newer UPP [message #45259 is a reply to message #45258] Sun, 25 October 2015 08:22 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
The fact that it was allocated from U++ does not in this case mean that the leak is caused by U++.

This looks like the memory block is allocated when loading skin. ColoredOverride is called on CtrlsImg Images.

If you have an Image in your code that is on the heap and gets assing CtrlsImg:: image, and is leaked, you are about to get the leak you are getting. E.g.:

GUI_APP_MAIN {
    Image *m = new Image;
    *m = CtrlsImg::SizeGrip();
    // m is not deleted and is a leak
}
Previous Topic: GetUserDefaultUILanguage identifier not found
Next Topic: OleAuto on Windows 7
Goto Forum:
  


Current Time: Fri Apr 19 16:15:27 CEST 2024

Total time taken to generate the page: 0.02508 seconds