Re: [Interest] Memory Leak when instantiating QWidget based windows

2016-09-10 Thread Sergio Martins
On Thursday, 8 September 2016 17:16:27 WEST Mike Jackson wrote:
> Does QtCreator come with suppression files for Qt5? I ran valgrind "by
> hand" on the command line and while I was able to actually find some of
> our leaks (yeah Valgrind..) I had to wade through 20,000 Qt leaks to
> find my leaks. Would be nice to filter those out somehow.

I doubt there are 2 Qt leaks, they are probably in libfreetype and 
libfontconfig.

You can generate a suppresion file with: valgrind --gen-suppresions=yes
then copy-paste the output to a file and load it


Regards,
Sérgio Martins

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Memory Leak when instantiating QWidget based windows

2016-09-10 Thread Andy
(Must be something wrong with the mail system - received this 2 days
later...)

I'm not sure if there's a suppression file in there, but with Qt Creator I
only get a handful of leaks at the end of my run that don't look like they
are related to my code.  Looks like something related to ImageLoaderMachO.

I have changed my Valigrind setting in the preferences, but I haven't set
any suppression files.

Were you ever able to get it working within Creator?  It would be worth the
effort since it parses all the results and makes it easy to jump to the
code in question.



---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney 


On Thu, Sep 8, 2016 at 5:16 PM, Mike Jackson  wrote:

> Does QtCreator come with suppression files for Qt5? I ran valgrind "by
> hand" on the command line and while I was able to actually find some of our
> leaks (yeah Valgrind..) I had to wade through 20,000 Qt leaks to find my
> leaks. Would be nice to filter those out somehow.
>
>
> --
> Michael A. Jackson
> BlueQuartz Software, LLC
> [e]: mike.jack...@bluequartz.net
>
>
> Andy wrote:
>
>> I too am using valgrind-3.11.0 (on Mac OS X 10.10.5), but I've never
>> seen that in the Application Output window.  I don't usually look there
>> when using Memcheck.
>>
>> Is there anything at all in the Memcheck panel?  Sometimes if your
>> application crashes when using valgrind there is useful info there.
>>
>> Are you running on the debug or release version of your application?
>>
>> Or could it be related this?:
>> https://bugreports.qt.io/browse/QTCREATORBUG-10163
>>
>>
>>
>> ---
>> Andy Maloney  // https://asmaloney.com
>> twitter ~ @asmaloney 
>>
>>
>> On Thu, Sep 8, 2016 at 9:37 AM, Edward Sutton > > wrote:
>>
>>
>> On Sep 8, 2016, at 8:18 AM, Andy >> > wrote:
>>>
>>> Ah - sorry.  I can see how that's unclear (pre-coffee email).
>>>
>>> I meant the Debug section on the left-hand side of the main
>>> window: Welcome, Edit, Design, Debug,...
>>>
>>> >0Then the bottom pane pops up below the editor and has a dropdown
>>> at the top-left - Debugger, Clang Static Analyzer, Memcheck,…
>>>
>>
>> Found it! Thank you.
>>
>> 3.1 - Selected Memcheck in the drop-down at lower-left main edit
>> window
>> 3.2 - Press green play button to the *right* of the Memcheck drop-down
>>
>> Unfortunately it did not run for me.
>>
>> Application Output reported:
>>
>> Analyzing finished.
>> ** Unknown error **
>>
>> Using valgrind-3.11.0
>>
>> -Ed
>>
>>
>>
>>> ---
>>> Andy Maloney  // https://asmaloney.com
>>> >> asmaloney.com=DQMFaQ=G4BpsyPyB19LB50bn2swXw=cAG2c-
>>> SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc=6HvvOEegoKg93yk53Owc
>>> eqGbTwWp3iEoQVNaZSRUkTM=bdAVC6-LbUYQycT9JFc91oa7YAOneh6j9LUG3pCqRmU=
>>> >
>>> twitter ~ @asmaloney
>>> >> twitter.com_asmaloney=DQMFaQ=G4BpsyPyB19LB50bn2swXw=cA
>>> G2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc=6HvvOEegoKg93yk5
>>> 3OwceqGbTwWp3iEoQVNaZSRUkTM=DErQyEPdZ-8bI_rhS90_
>>> nSKoH2XfmOa5EdwR_Dzu7pU=>
>>>
>>>
>>> On Thu, Sep 8, 2016 at 9:13 AM, Edward Sutton
>>> >
>>> wrote:
>>>
>>> Hi Andy,
>>>
>>> Could you please elaborate on step #3?
>>>
>>> I cannot find a Memcheck option under Preferences > Debugger.
>>>
>>> Thanks for the tips!
>>>
>>> -Ed
>>> Qt Creator 4.01 with Qt 5.6.1
>>>
>>>
>>> On Sep 8, 2016, at 7:56 AM, Andy > wrote:

 Mike:

 If you haven't already tried it, using Qt Creator in
 combination with valgrind works really well to track these
 kinds of things down.

 The basics:

   1) install valgrind (I used homebrew)
   2) point Qt Creator at it in the prefs (Analyzer->Valgrind)
   3) Click the Debug tab, set the tool to Memcheck, and click
 the start button (little green arrow)

 After it runs your application (slowly), it will spit out a
 bunch of info about memory leaks that make it pretty easy to
 track down the problems.




 ---
 Andy Maloney  // https://asmaloney.com
 
 twitter ~ @asmaloney
 

Re: [Interest] Memory Leak when instantiating QWidget based windows

2016-09-10 Thread Bo Thorsen

Den 08-09-2016 kl. 12:55 skrev Konstantin Shegunov:


On Wed, Sep 7, 2016 at 11:23 PM, Mike Jackson > wrote:

We monitor the memory use before and after the loop using OS X's
Activity monitor. At the end of the loop there is more memory being
used than before the loop, by about 2~3MB worth.

This isn't reliable. Consider the following C++ only code:

int main(intargc,char**argv)
{
  struct X;
  X * x = nullptr;

  struct X {
int data[1024];
  };

  for(qint32i=0;i<10;i++){
x = new X[1024];
delete x;
  }

  return 0;
}

In the KSysGuard (KDE's system monitor) I observe for the memory
consumption: 12 908k, 23 048k shared before the loop and 12 944k, 25
112k shared after the loop. There isn't a leak here, yet there's a
difference. The OS's heap manager may free the memory immediately, may
cache it, or hold on to it. Ultimately it's out of your control, that's
why you should use a code analyzer (like valgrind to track leaks).


You need to use "delete[] x;" or you can't say that you don't have a 
memory leak.


Bo Thorsen,
Director, Viking Software.

--
Viking Software
Qt and C++ developers for hire
http://www.vikingsoft.eu
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Memory Leak when instantiating QWidget based windows

2016-09-10 Thread Mike Jackson
Does QtCreator come with suppression files for Qt5? I ran valgrind "by 
hand" on the command line and while I was able to actually find some of 
our leaks (yeah Valgrind..) I had to wade through 20,000 Qt leaks to 
find my leaks. Would be nice to filter those out somehow.



--
Michael A. Jackson
BlueQuartz Software, LLC
[e]: mike.jack...@bluequartz.net


Andy wrote:

I too am using valgrind-3.11.0 (on Mac OS X 10.10.5), but I've never
seen that in the Application Output window.  I don't usually look there
when using Memcheck.

Is there anything at all in the Memcheck panel?  Sometimes if your
application crashes when using valgrind there is useful info there.

Are you running on the debug or release version of your application?

Or could it be related this?:
https://bugreports.qt.io/browse/QTCREATORBUG-10163



---
Andy Maloney  // https://asmaloney.com
twitter ~ @asmaloney 


On Thu, Sep 8, 2016 at 9:37 AM, Edward Sutton > wrote:



On Sep 8, 2016, at 8:18 AM, Andy > wrote:

Ah - sorry.  I can see how that's unclear (pre-coffee email).

I meant the Debug section on the left-hand side of the main
window: Welcome, Edit, Design, Debug,...

>0Then the bottom pane pops up below the editor and has a dropdown
at the top-left - Debugger, Clang Static Analyzer, Memcheck,…


Found it! Thank you.

3.1 - Selected Memcheck in the drop-down at lower-left main edit window
3.2 - Press green play button to the *right* of the Memcheck drop-down

Unfortunately it did not run for me.

Application Output reported:

Analyzing finished.
** Unknown error **

Using valgrind-3.11.0

-Ed




---
Andy Maloney  // https://asmaloney.com


twitter ~ @asmaloney




On Thu, Sep 8, 2016 at 9:13 AM, Edward Sutton
> wrote:

Hi Andy,

Could you please elaborate on step #3?

I cannot find a Memcheck option under Preferences > Debugger.

Thanks for the tips!

-Ed
Qt Creator 4.01 with Qt 5.6.1



On Sep 8, 2016, at 7:56 AM, Andy > wrote:

Mike:

If you haven't already tried it, using Qt Creator in
combination with valgrind works really well to track these
kinds of things down.

The basics:

  1) install valgrind (I used homebrew)
  2) point Qt Creator at it in the prefs (Analyzer->Valgrind)
  3) Click the Debug tab, set the tool to Memcheck, and click
the start button (little green arrow)

After it runs your application (slowly), it will spit out a
bunch of info about memory leaks that make it pretty easy to
track down the problems.




---
Andy Maloney  // https://asmaloney.com


twitter ~ @asmaloney




On Thu, Sep 8, 2016 at 6:55 AM, Konstantin Shegunov
> wrote:


On Wed, Sep 7, 2016 at 11:23 PM, Mike Jackson
>
wrote:

We monitor the memory use before and after the loop
using OS X's Activity monitor. At the end of the loop
there is more memory being used than before the loop,
by about 2~3MB worth.


This isn't reliable. Consider the following C++ only code:

intmain(intargc,char**argv)

{

 struct  X;

 X  *  x  =  nullptr;


 struct  X  {

 int  data[1024];

 };


 for  (qint32  i  =  0;  i  <  10;  i++)   {

 x  =  new  X[1024];

 delete  x;

 }

 return  0;

 

Re: [Interest] Memory Leak when instantiating QWidget based windows

2016-09-08 Thread Andy
I too am using valgrind-3.11.0 (on Mac OS X 10.10.5), but I've never seen
that in the Application Output window.  I don't usually look there when
using Memcheck.

Is there anything at all in the Memcheck panel?  Sometimes if your
application crashes when using valgrind there is useful info there.

Are you running on the debug or release version of your application?

Or could it be related this?:
https://bugreports.qt.io/browse/QTCREATORBUG-10163



---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney 


On Thu, Sep 8, 2016 at 9:37 AM, Edward Sutton 
wrote:

>
> On Sep 8, 2016, at 8:18 AM, Andy  wrote:
>
> Ah - sorry.  I can see how that's unclear (pre-coffee email).
>
> I meant the Debug section on the left-hand side of the main window:
> Welcome, Edit, Design, Debug,...
>
> >0Then the bottom pane pops up below the editor and has a dropdown at the
> top-left - Debugger, Clang Static Analyzer, Memcheck,…
>
>
> Found it! Thank you.
>
> 3.1 - Selected Memcheck in the drop-down at lower-left main edit window
> 3.2 - Press green play button to the *right* of the Memcheck drop-down
>
> Unfortunately it did not run for me.
>
> Application Output reported:
>
> Analyzing finished.
> ** Unknown error **
>
> Using valgrind-3.11.0
>
> -Ed
>
>
>
> ---
> Andy Maloney  //  https://asmaloney.com
> 
> twitter ~ @asmaloney
> 
>
>
> On Thu, Sep 8, 2016 at 9:13 AM, Edward Sutton 
> wrote:
>
>> Hi Andy,
>>
>> Could you please elaborate on step #3?
>>
>> I cannot find a Memcheck option under Preferences > Debugger.
>>
>> Thanks for the tips!
>>
>> -Ed
>> Qt Creator 4.01 with Qt 5.6.1
>>
>>
>> On Sep 8, 2016, at 7:56 AM, Andy  wrote:
>>
>> Mike:
>>
>> If you haven't already tried it, using Qt Creator in combination with
>> valgrind works really well to track these kinds of things down.
>>
>> The basics:
>>
>>   1) install valgrind (I used homebrew)
>>   2) point Qt Creator at it in the prefs (Analyzer->Valgrind)
>>   3) Click the Debug tab, set the tool to Memcheck, and click the start
>> button (little green arrow)
>>
>> After it runs your application (slowly), it will spit out a bunch of info
>> about memory leaks that make it pretty easy to track down the problems.
>>
>>
>>
>>
>> ---
>> Andy Maloney  //  https://asmaloney.com
>> 
>> twitter ~ @asmaloney
>> 
>>
>>
>> On Thu, Sep 8, 2016 at 6:55 AM, Konstantin Shegunov 
>> wrote:
>>
>>>
>>> On Wed, Sep 7, 2016 at 11:23 PM, Mike Jackson 
>>> wrote:
>>>
 We monitor the memory use before and after the loop using OS X's
 Activity monitor. At the end of the loop there is more memory being used
 than before the loop, by about 2~3MB worth.

>>>
>>> This isn't reliable. Consider the following C++ only code:
>>>
>>> int main(int argc, char ** argv)
>>>
>>> {
>>>
>>> struct X;
>>>
>>> X * x = nullptr;
>>>
>>>
>>> struct X {
>>>
>>> int data[1024];
>>>
>>> };
>>>
>>>
>>> for (qint32 i = 0; i < 10; i++)  {
>>>
>>> x = new X[1024];
>>>
>>> delete x;
>>>
>>> }
>>>
>>> return 0;
>>>
>>> }
>>>
>>>
>>> In the KSysGuard (KDE's system monitor) I observe for the memory 
>>> consumption: 12 908k, 23 048k shared before the loop and 12 944k, 25 112k 
>>> shared after the loop. There isn't a leak here, yet there's a difference. 
>>> The OS's heap manager may free the memory immediately, may cache it, or 
>>> hold on to it. Ultimately it's out of your control, that's why you should 
>>> use a code analyzer (like valgrind to track leaks).
>>>
>>>
>>> Kind regards.
>>>
>>>
>>> ___
>>> Interest mailing list
>>> Interest@qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/interest
>>> 

Re: [Interest] Memory Leak when instantiating QWidget based windows

2016-09-08 Thread Edward Sutton

On Sep 8, 2016, at 8:18 AM, Andy 
> wrote:

Ah - sorry.  I can see how that's unclear (pre-coffee email).

I meant the Debug section on the left-hand side of the main window: Welcome, 
Edit, Design, Debug,...

>0Then the bottom pane pops up below the editor and has a dropdown at the 
>top-left - Debugger, Clang Static Analyzer, Memcheck,…

Found it! Thank you.

3.1 - Selected Memcheck in the drop-down at lower-left main edit window
3.2 - Press green play button to the *right* of the Memcheck drop-down

Unfortunately it did not run for me.

Application Output reported:

Analyzing finished.
** Unknown error **

Using valgrind-3.11.0

-Ed



---
Andy Maloney  //  
https://asmaloney.com
twitter ~ 
@asmaloney


On Thu, Sep 8, 2016 at 9:13 AM, Edward Sutton 
> wrote:
Hi Andy,

Could you please elaborate on step #3?

I cannot find a Memcheck option under Preferences > Debugger.

Thanks for the tips!

-Ed
Qt Creator 4.01 with Qt 5.6.1


On Sep 8, 2016, at 7:56 AM, Andy 
> wrote:

Mike:

If you haven't already tried it, using Qt Creator in combination with valgrind 
works really well to track these kinds of things down.

The basics:

  1) install valgrind (I used homebrew)
  2) point Qt Creator at it in the prefs (Analyzer->Valgrind)
  3) Click the Debug tab, set the tool to Memcheck, and click the start button 
(little green arrow)

After it runs your application (slowly), it will spit out a bunch of info about 
memory leaks that make it pretty easy to track down the problems.




---
Andy Maloney  //  
https://asmaloney.com
twitter ~ 
@asmaloney


On Thu, Sep 8, 2016 at 6:55 AM, Konstantin Shegunov 
> wrote:

On Wed, Sep 7, 2016 at 11:23 PM, Mike Jackson 
> wrote:
We monitor the memory use before and after the loop using OS X's Activity 
monitor. At the end of the loop there is more memory being used than before the 
loop, by about 2~3MB worth.

This isn't reliable. Consider the following C++ only code:

int main(int argc, char ** argv)

{

struct X;

X * x = nullptr;


struct X {

int data[1024];

};


for (qint32 i = 0; i < 10; i++)  {

x = new X[1024];

delete x;

}


return 0;

}


In the KSysGuard (KDE's system monitor) I observe for the memory consumption: 
12 908k, 23 048k shared before the loop and 12 944k, 25 112k shared after the 
loop. There isn't a leak here, yet there's a difference. The OS's heap manager 
may free the memory immediately, may cache it, or hold on to it. Ultimately 
it's out of your control, that's why you should use a code analyzer (like 
valgrind to track leaks).


Kind regards.

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.qt-2Dproject.org_mailman_listinfo_interest=DQICAg=G4BpsyPyB19LB50bn2swXw=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc=c5VUb3aKymRQx0ih8A7yljotGOJbYdQ2iJ1PDgaS508=LqLQXbnpsD6fQrnO0sB2UvftUi_snCYjEZU1tDFt7So=

This email and any files transmitted with it from The Charles Machine Works, 
Inc. are confidential and intended solely for the use of the individual or 
entity to which they are addressed. If you have received this email in error 
please notify the sender. Our company accepts no liability for the contents of 
this email, or for the consequences of any 

Re: [Interest] Memory Leak when instantiating QWidget based windows

2016-09-08 Thread Andy
Ah - sorry.  I can see how that's unclear (pre-coffee email).

I meant the Debug section on the left-hand side of the main window:
Welcome, Edit, Design, Debug,...

Then the bottom pane pops up below the editor and has a dropdown at the
top-left - Debugger, Clang Static Analyzer, Memcheck,...

---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney 


On Thu, Sep 8, 2016 at 9:13 AM, Edward Sutton 
wrote:

> Hi Andy,
>
> Could you please elaborate on step #3?
>
> I cannot find a Memcheck option under Preferences > Debugger.
>
> Thanks for the tips!
>
> -Ed
> Qt Creator 4.01 with Qt 5.6.1
>
>
> On Sep 8, 2016, at 7:56 AM, Andy  wrote:
>
> Mike:
>
> If you haven't already tried it, using Qt Creator in combination with
> valgrind works really well to track these kinds of things down.
>
> The basics:
>
>   1) install valgrind (I used homebrew)
>   2) point Qt Creator at it in the prefs (Analyzer->Valgrind)
>   3) Click the Debug tab, set the tool to Memcheck, and click the start
> button (little green arrow)
>
> After it runs your application (slowly), it will spit out a bunch of info
> about memory leaks that make it pretty easy to track down the problems.
>
>
>
>
> ---
> Andy Maloney  //  https://asmaloney.com
> 
> twitter ~ @asmaloney
> 
>
>
> On Thu, Sep 8, 2016 at 6:55 AM, Konstantin Shegunov 
> wrote:
>
>>
>> On Wed, Sep 7, 2016 at 11:23 PM, Mike Jackson 
>> wrote:
>>
>>> We monitor the memory use before and after the loop using OS X's
>>> Activity monitor. At the end of the loop there is more memory being used
>>> than before the loop, by about 2~3MB worth.
>>>
>>
>> This isn't reliable. Consider the following C++ only code:
>>
>> int main(int argc, char ** argv)
>>
>> {
>>
>> struct X;
>>
>> X * x = nullptr;
>>
>>
>> struct X {
>>
>> int data[1024];
>>
>> };
>>
>>
>> for (qint32 i = 0; i < 10; i++)  {
>>
>> x = new X[1024];
>>
>> delete x;
>>
>> }
>>
>> return 0;
>>
>> }
>>
>>
>> In the KSysGuard (KDE's system monitor) I observe for the memory 
>> consumption: 12 908k, 23 048k shared before the loop and 12 944k, 25 112k 
>> shared after the loop. There isn't a leak here, yet there's a difference. 
>> The OS's heap manager may free the memory immediately, may cache it, or hold 
>> on to it. Ultimately it's out of your control, that's why you should use a 
>> code analyzer (like valgrind to track leaks).
>>
>>
>> Kind regards.
>>
>>
>> ___
>> Interest mailing list
>> Interest@qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>> 
>>
>>
> ___
> Interest mailing list
> Interest@qt-project.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.
> qt-2Dproject.org_mailman_listinfo_interest=DQICAg=
> G4BpsyPyB19LB50bn2swXw=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc=
> c5VUb3aKymRQx0ih8A7yljotGOJbYdQ2iJ1PDgaS508=LqLQXbnpsD6fQrnO0sB2UvftUi_
> snCYjEZU1tDFt7So=
>
>
> This email and any files transmitted with it from The Charles Machine
> Works, Inc. are confidential and intended solely for the use of the
> individual or entity to which they are addressed. If you have received this
> email in error please notify the sender. Our company accepts no liability
> for the contents of this email, or for the consequences of any actions
> taken on the basis of the information provided, unless that information is
> subsequently confirmed in writing. Please note that any views or opinions
> presented in this email are solely those of the author and do not
> necessarily represent those of the company. Finally, the recipient should
> check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus transmitted
> by this email.
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Memory Leak when instantiating QWidget based windows

2016-09-08 Thread Edward Sutton
Hi Andy,

Could you please elaborate on step #3?

I cannot find a Memcheck option under Preferences > Debugger.

Thanks for the tips!

-Ed
Qt Creator 4.01 with Qt 5.6.1


On Sep 8, 2016, at 7:56 AM, Andy 
> wrote:

Mike:

If you haven't already tried it, using Qt Creator in combination with valgrind 
works really well to track these kinds of things down.

The basics:

  1) install valgrind (I used homebrew)
  2) point Qt Creator at it in the prefs (Analyzer->Valgrind)
  3) Click the Debug tab, set the tool to Memcheck, and click the start button 
(little green arrow)

After it runs your application (slowly), it will spit out a bunch of info about 
memory leaks that make it pretty easy to track down the problems.




---
Andy Maloney  //  
https://asmaloney.com
twitter ~ 
@asmaloney


On Thu, Sep 8, 2016 at 6:55 AM, Konstantin Shegunov 
> wrote:

On Wed, Sep 7, 2016 at 11:23 PM, Mike Jackson 
> wrote:
We monitor the memory use before and after the loop using OS X's Activity 
monitor. At the end of the loop there is more memory being used than before the 
loop, by about 2~3MB worth.

This isn't reliable. Consider the following C++ only code:

int main(int argc, char ** argv)

{

struct X;

X * x = nullptr;


struct X {

int data[1024];

};


for (qint32 i = 0; i < 10; i++)  {

x = new X[1024];

delete x;

}


return 0;

}


In the KSysGuard (KDE's system monitor) I observe for the memory consumption: 
12 908k, 23 048k shared before the loop and 12 944k, 25 112k shared after the 
loop. There isn't a leak here, yet there's a difference. The OS's heap manager 
may free the memory immediately, may cache it, or hold on to it. Ultimately 
it's out of your control, that's why you should use a code analyzer (like 
valgrind to track leaks).


Kind regards.

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.qt-2Dproject.org_mailman_listinfo_interest=DQICAg=G4BpsyPyB19LB50bn2swXw=cAG2c-SQES5P2qb8IW-uwnBOCX_f2qYJIlzenFnoHUc=c5VUb3aKymRQx0ih8A7yljotGOJbYdQ2iJ1PDgaS508=LqLQXbnpsD6fQrnO0sB2UvftUi_snCYjEZU1tDFt7So=

This email and any files transmitted with it from The Charles Machine Works, 
Inc. are confidential and intended solely for the use of the individual or 
entity to which they are addressed. If you have received this email in error 
please notify the sender. Our company accepts no liability for the contents of 
this email, or for the consequences of any actions taken on the basis of the 
information provided, unless that information is subsequently confirmed in 
writing. Please note that any views or opinions presented in this email are 
solely those of the author and do not necessarily represent those of the 
company. Finally, the recipient should check this email and any attachments for 
the presence of viruses. The company accepts no liability for any damage caused 
by any virus transmitted by this email.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Memory Leak when instantiating QWidget based windows

2016-09-08 Thread Andy
Mike:

If you haven't already tried it, using Qt Creator in combination with
valgrind works really well to track these kinds of things down.

The basics:

  1) install valgrind (I used homebrew)
  2) point Qt Creator at it in the prefs (Analyzer->Valgrind)
  3) Click the Debug tab, set the tool to Memcheck, and click the start
button (little green arrow)

After it runs your application (slowly), it will spit out a bunch of info
about memory leaks that make it pretty easy to track down the problems.




---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney 


On Thu, Sep 8, 2016 at 6:55 AM, Konstantin Shegunov 
wrote:

>
> On Wed, Sep 7, 2016 at 11:23 PM, Mike Jackson 
> wrote:
>
>> We monitor the memory use before and after the loop using OS X's Activity
>> monitor. At the end of the loop there is more memory being used than before
>> the loop, by about 2~3MB worth.
>>
>
> This isn't reliable. Consider the following C++ only code:
>
> int main(int argc, char ** argv)
>
> {
>
> struct X;
>
> X * x = nullptr;
>
>
> struct X {
>
> int data[1024];
>
> };
>
>
> for (qint32 i = 0; i < 10; i++)  {
>
> x = new X[1024];
>
> delete x;
>
> }
>
> return 0;
>
> }
>
>
> In the KSysGuard (KDE's system monitor) I observe for the memory consumption: 
> 12 908k, 23 048k shared before the loop and 12 944k, 25 112k shared after the 
> loop. There isn't a leak here, yet there's a difference. The OS's heap 
> manager may free the memory immediately, may cache it, or hold on to it. 
> Ultimately it's out of your control, that's why you should use a code 
> analyzer (like valgrind to track leaks).
>
>
> Kind regards.
>
>
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Memory Leak when instantiating QWidget based windows

2016-09-08 Thread william.croc...@analog.com

On 09/07/2016 04:23 PM, Mike Jackson wrote:

We are attempting to track down a memory leak that we _think_ we have. We have
reduced our code to the point where all we do is invoke a new QWidget instance,
show() it, hide() it and then delete it. We do this in a loop 100 times. We
monitor the memory use before and after the loop using OS X's Activity monitor.
At the end of the loop there is more memory being used than before the loop, by
about 2~3MB worth.

My question is: Is this normal for a Qt Application to retain some memory for
each QWidget through global variables and such? Is it something in OS X 10.10?

Thanks to anyone who can shed a little light on this for us. Oh. This is with Qt
5.6.1-1 on OS X 10.10.5. We also notice this on Windows 10 with the same version
of Qt.



You should add valgrind to your toolbox.
Valgrind can track memory usage and note leaks.


Thanks


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Memory Leak when instantiating QWidget based windows

2016-09-08 Thread Konstantin Shegunov
On Wed, Sep 7, 2016 at 11:23 PM, Mike Jackson 
wrote:

> We monitor the memory use before and after the loop using OS X's Activity
> monitor. At the end of the loop there is more memory being used than before
> the loop, by about 2~3MB worth.
>

This isn't reliable. Consider the following C++ only code:

int main(int argc, char ** argv)

{

struct X;

X * x = nullptr;


struct X {

int data[1024];

};


for (qint32 i = 0; i < 10; i++)  {

x = new X[1024];

delete x;

}

return 0;

}


In the KSysGuard (KDE's system monitor) I observe for the memory
consumption: 12 908k, 23 048k shared before the loop and 12 944k, 25
112k shared after the loop. There isn't a leak here, yet there's a
difference. The OS's heap manager may free the memory immediately, may
cache it, or hold on to it. Ultimately it's out of your control,
that's why you should use a code analyzer (like valgrind to track
leaks).


Kind regards.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest