Memory leaks on Mac OS X wxWidgets 3.1 sample dialog

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
mohdfaiz
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Nov 23, 2018 1:21 pm

Memory leaks on Mac OS X wxWidgets 3.1 sample dialog

Post by mohdfaiz »

Hello ,

I am curious and amazed that recently I have noticed a significant memory leak observed with Activity monitor on Mac OS 10.13 (Xcode 9) using dialog sample , I build sample and from menu launched "Rich Message dialog" and can observe memory leaks of around 8 MB subsequent to each launch on My Mac Book Pro (Intel core i7 , 2.2 GHz , Cores - 4, 16GB RAM , SSD ) , I monitored memory usage in Activity monitor before and after launch of Modal dialog and I can see jump of 8 MB as mentioned above.In general I also noticed in many wxWidget dialogs there is leaks. This problem does not happen on Windows and predominantly visisble on Mac OS X 10.11-10.14 (list of OS i observed).
I am guessing this may be wxWidgets Mac UI implementation issue in terms of freeing up memory but I am not sure.
May I ask if someone in the forum faced memory leak issues with wxWidget samples and if there exist a solution to problem.

Regards
Faiz
Manolo
Can't get richer than this
Can't get richer than this
Posts: 827
Joined: Mon Apr 30, 2012 11:07 pm

Re: Memory leaks on Mac OS X wxWidgets 3.1 sample dialog

Post by Manolo »

Memory leaks in wxWidgets are possible, but very unlikely due to so long the code has been tested.

Are you sure you see a leak or it's just the OS showing how much memory is set as available to the app?
OS's use to handle memory in chunks, not by the exact amount requested by the app.

A more detailed memory usage tool is Valgrind.
mohdfaiz
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Nov 23, 2018 1:21 pm

Re: Memory leaks on Mac OS X wxWidgets 3.1 sample dialog

Post by mohdfaiz »

Thanks for your response , what i termed as leak is based on my observation of activity monitor showing memory consumption by an Application.
In this case I launch minimal_cocoa app built using dialogs.cpp file and observation are shared below on Activity monitor (Memory column) :
{1}
1-Launch App : 14.5BM
2-Mouse hover Dialogs menu and highlight "Rich Message dialog" option : 15.6MB
3-Click "Rich Message dialog" : Dialog is launched : 18.1MB
4-Click Close on dialog : 25.1 MB

Note : After each step wait for a few second to let stabilise Memory shown in activity monitor

Repeat steps 2-4 and note Memory usage in activity monitor
{2}
2-Mouse hover Dialogs menu and highlight "Rich Message dialog" option : 26.2 MB
3-Click "Rich Message dialog" : Dialog is launched : 33.5 MB
4-Click Close on dialog : 34.2 MB
{3}
2-Mouse hover Dialogs menu and highlight "Rich Message dialog" option : 34.6 MB
3-Click "Rich Message dialog" : Dialog is launched : 35.5 MB
4-Click Close on dialog : 42.4 MB
{4}
2-Mouse hover Dialogs menu and highlight "Rich Message dialog" option : 42.5 MB
3-Click "Rich Message dialog" : Dialog is launched : 42.8 (On launch it jumps to 52.2 MB and after few second comes down to 42.8 MB)
4-Click Close on dialog : 49.7 MB (On Close it jumps to 58.6 MB and after few second comes down to 49.7 MB)
{5}
2-Mouse hover Dialogs menu and highlight "Rich Message dialog" option : 50.3 MB
3-Click "Rich Message dialog" : Dialog is launched : 51.1 (On launch it jumps to 60.0 MB and after few second comes down to 51.1 MB)
4-Click Close on dialog : 57.6 MB (No significant jump in Memory observed )
{6}
2-Mouse hover Dialogs menu and highlight "Rich Message dialog" option : 57.9 MB
3-Click "Rich Message dialog" : Dialog is launched : 58.3 (No significant jump in Memory observed )
4-Click Close on dialog : 65.2 MB (On Close it jumps to 65.9 MB and after few second comes down to 65.2 MB)
{7}
2-Mouse hover Dialogs menu and highlight "Rich Message dialog" option : 65.5 MB
3-Click "Rich Message dialog" : Dialog is launched : 66.1 (No significant jump in Memory observed )
4-Click Close on dialog : 72.6 MB (On Close it jumps to 77.5 MB and after few second comes down to 72.6 MB)
{8}
2-Mouse hover Dialogs menu and highlight "Rich Message dialog" option : 73.0 MB
3-Click "Rich Message dialog" : Dialog is launched : 73.8 (No significant jump in Memory observed )
4-Click Close on dialog : 80.3 MB (On Close it jumps to 80.4 MB and after few second comes down to 80.3 MB)

So the difference in memory in 8 instances : 80.3-14.5 = 65.8
Each instance memory leak : 65.8/8 = 8.23 MB
Post Reply