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 » U++ Library support » U++ Library : Other (not classified elsewhere) » Uninitialized class members.
Re: Uninitialized class members. [message #15801 is a reply to message #15799] Thu, 08 May 2008 00:21 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mdelfede wrote on Wed, 07 May 2008 18:06


Uhmmmm.... I don't know, but I guess there should be a way to redirect GDB/Valgrind output to a different stream than app output... or, you could attach user app output to a different stream than stdout/stderr.
I'll investigate that one, maybe Smile

Max




As I wrote previously:

    --log-fd=<number>         log messages to file descriptor [2=stderr]
    --log-file=<file>         log messages to <file>
    --xml=yes                 all output is in XML (some tools only)



Regards,
Novo
Re: Uninitialized class members. [message #15804 is a reply to message #15792] Thu, 08 May 2008 01:00 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Wed, 07 May 2008 17:05

luzr wrote on Wed, 07 May 2008 16:47

-ScrollBar::ScrollBar() {
+ScrollBar::ScrollBar() 
+: style(NULL)
+, pagepos(0)
+, pagesize(0)
+, totalsize(0)
+{
 	minthumb = 16;
-	pagepos = pagesize = totalsize = 0;
 	linesize = 1;


?

Same for ArrayCtrl, RichTextView, TopWindow, Ide, Browser....

Mirek


I personally would move all initialization of members into initialization lists, if I understand you correctly.



OK, I will be thinking about it, although I do not find it particulary atractive... Anyway, for now, I just wanted to clarify the problem:)

Mirek
Re: Uninitialized class members. [message #15808 is a reply to message #15804] Thu, 08 May 2008 05:37 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
luzr wrote on Wed, 07 May 2008 19:00

OK, I will be thinking about it, although I do not find it particulary atractive... Anyway, for now, I just wanted to clarify the problem:)

Mirek


The problem is that when you want to run valgrind on TheIDE to understand why it is crashing in release build, you see thousands of messages about using uninitialized memory.

It is just impossible to find something useful among them. Each of them can be a problem.

And of course, there are other concerns ...


Regards,
Novo
Re: Uninitialized class members. [message #15809 is a reply to message #15808] Thu, 08 May 2008 08:00 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I think the question was whether valgrind detected a problem in ArrayCtrl (and others) when initialization was in constructor body vs in initializer list.

Anyway, I hope I will try myself today...

Mirek
Re: Uninitialized class members. [message #15828 is a reply to message #15809] Fri, 09 May 2008 04:37 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
luzr wrote on Thu, 08 May 2008 02:00

I think the question was whether valgrind detected a problem in ArrayCtrl (and others) when initialization was in constructor body vs in initializer list.



Sorry, I misunderstood you.

Yes, it can detect that. If an uninitialized variable was used in an arithmetic expression, and that expression was used in a logical expression after that, you will be warned. Actually, it is really hard to figure out which exactly variable was that. It is much easier to put all members onto initialization list.

valgrind is very important tool to me, and I'd like to see U++ valgrind-frendly, and I'm ready to help. Smile

Besides, it helps find bugs. Wink


Regards,
Novo

[Updated on: Fri, 09 May 2008 04:57]

Report message to a moderator

Re: Uninitialized class members. [message #15841 is a reply to message #15828] Sun, 11 May 2008 18:01 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Thu, 08 May 2008 22:37

luzr wrote on Thu, 08 May 2008 02:00

I think the question was whether valgrind detected a problem in ArrayCtrl (and others) when initialization was in constructor body vs in initializer list.



Sorry, I misunderstood you.

Yes, it can detect that. If an uninitialized variable was used in an arithmetic expression, and that expression was used in a logical expression after that, you will be warned. Actually, it is really hard to figure out which exactly variable was that. It is much easier to put all members onto initialization list.

valgrind is very important tool to me, and I'd like to see U++ valgrind-frendly, and I'm ready to help. Smile

Besides, it helps find bugs. Wink



Well, I believe theide and U++ is now quite valgrind friendly.

Anyway, I am seeing a lot of "invalid read" entries, but none seems to originate from U++ code (they seem to be "ld", "glibc" and "gtk" issues). What to think about it?

(Of course, valgrind reports a lot of leaks, but that is the same problem IMO; there should be no leaks in U++ code).

Mirek
Re: Uninitialized class members. [message #15846 is a reply to message #15841] Sun, 11 May 2008 20:43 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
luzr wrote on Sun, 11 May 2008 12:01

Well, I believe theide and U++ is now quite valgrind friendly.



Thank you very much!

Quote:


Anyway, I am seeing a lot of "invalid read" entries, but none seems to originate from U++ code (they seem to be "ld", "glibc" and "gtk" issues). What to think about it?



The is nothing you can do about these "ld", "glibc" and "gtk" issues. Valgrind allows you to provide a suppression file. Suppressions can be generated by valgrind automatically (in interactive mode).

I personally never use valgrind without a customized suppression file.

Quote:


(Of course, valgrind reports a lot of leaks, but that is the same problem IMO; there should be no leaks in U++ code).



It depend on what you call a leak. As I remember, valgrind reports a lot of "potentially lost memory". That usually means that there is non-freed memory on application exit. People usually do not care about that memory because their application is going to stop working anyway, but valgrind does. Wink

These "memory leaks" are usually fixed by eliminating static objects (like strings) and registering memory pools cleanups with atexit().

I'll take a look at that when I get a chance.

Thank you for integrating TheIDE with valgrind again!


Regards,
Novo

[Updated on: Sun, 11 May 2008 20:43]

Report message to a moderator

Re: Uninitialized class members. [message #15849 is a reply to message #15846] Sun, 11 May 2008 22:56 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Sun, 11 May 2008 14:43


It depend on what you call a leak. As I remember, valgrind reports a lot of "potentially lost memory". That usually means that there is non-freed memory on application exit. People usually do not care about that memory because their application is going to stop working anyway, but valgrind does. Wink



Actually, U++ will complain there too, unless you use "MemoryAllocPermanent"... (or activate leak supression block).

Mirek
Re: Uninitialized class members. [message #15959 is a reply to message #15849] Mon, 19 May 2008 22:23 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
BTW, Novo.... don't you have a ready-to-use valgrind suppression file, in order to avoid thousends of useless reports about internal gnome/gtk/x11 problems ? Smile

Max
Re: Uninitialized class members. [message #15960 is a reply to message #15959] Mon, 19 May 2008 23:20 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mdelfede wrote on Mon, 19 May 2008 16:23

BTW, Novo.... don't you have a ready-to-use valgrind suppression file, in order to avoid thousends of useless reports about internal gnome/gtk/x11 problems ? Smile

Max



I'll prepare one for X11 + Ubunu 7.10. Unfortunately I cannot build against GTK because of a glitch in TheIDE in release mode, which always compiles static version instead of DLL-based. :-/


Regards,
Novo
Re: Uninitialized class members. [message #15969 is a reply to message #15960] Tue, 20 May 2008 13:44 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Thank you !
I think Valgrind can be really useful then!

Max
Re: Uninitialized class members. [message #16164 is a reply to message #15969] Fri, 30 May 2008 06:06 Go to previous message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
http://www.ultimatepp.org/forum/index.php?t=msg&goto=161 63

No GTK at the moment. Only X11.


Regards,
Novo
Previous Topic: Display problem with Splitter, GLCtrl and MenuBar
Next Topic: Ide console
Goto Forum:
  


Current Time: Thu Apr 25 09:22:44 CEST 2024

Total time taken to generate the page: 0.08895 seconds