Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Uninitialized class members.
|
Re: Uninitialized class members. [message #15804 is a reply to message #15792] |
Thu, 08 May 2008 01:00 |
|
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 |
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 #15828 is a reply to message #15809] |
Fri, 09 May 2008 04:37 |
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.
Besides, it helps find bugs.
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 |
|
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.
Besides, it helps find bugs.
|
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 |
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.
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
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sat May 04 16:49:15 CEST 2024
Total time taken to generate the page: 0.02768 seconds
|