I have an application which runs on Mac ever since 10.6. But recently I found a strange thing.
python2.7 +wxpython 3.0
My application calls wx.Refresh(Erasebackground=False) , based on a timer (50ms), and this function kind of cause problem. (Timer doesn’t matter here, because I adjusted timer from 50ms to 1s and no improvement on anything.)
I ran the app on 4 different MacBooks,
on two of them(call them good Mac), wx.Refresh() generate 3-4 extra threads in addition to some basic threads while wx.Refresh() is disabled intentionally. App runs very well.
on the other two Mac (call them bad Mac), wx.Refresh() generates 12-13 extra threads. Without doubt, my app runs badlly on these two Mac. And on these mac, CPU usage of my app goes up to as high as 125%.
The sample information from activity monitor shows the 12-13 extra threads are generated by api from wxpython: wxWindow::MacDoRedraw(long)
- 2062 NSDisplayCycleObserverInvoke (in AppKit) + 155 [0x7fff37ee7cc8]
- 2061 __NSWindowGetDisplayCycleObserverForDisplay_block_invoke (in AppKit) + 646 [0x7fff37eec1ef]
- ! 2061 -[NSWindow displayIfNeeded] (in AppKit) + 261 [0x7fff37eec39b]
- ! 2061 -[NSView displayIfNeeded] (in AppKit) + 755 [0x7fff37eef213]
- ! 2055 -[NSView _oldDisplayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] (in AppKit) + 2126 [0x7fff37ef305b]
- ! : 1985 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] (in AppKit) + 3503 [0x7fff37ef5ebb]
- ! : | 1735 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] (in AppKit) + 3503 [0x7fff37ef5ebb]
- ! : | + 1723 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] (in AppKit) + 2143 [0x7fff37ef596b]
- ! : | + ! 1723 -[NSView _drawRect:clip:] (in AppKit) + 1103 [0x7fff37ef7444]
- ! : | + ! 1723 _NSViewDrawRect (in AppKit) + 139 [0x7fff37f0807b]
- ! : | + ! 1723 wxOSX_drawRect(NSView*, objc_selector*, CGRect) (in libwx_osx_cocoau-3.0.0.3.0.dylib) + 358 [0x1058d0376]
- ! : | + ! 1722 wxWidgetCocoaImpl::drawRect(void*, NSView*, void*) (in libwx_osx_cocoau-3.0.0.3.0.dylib) + 690 [0x1058d06f2]
- ! : | + ! : 1720 wxWindow::MacDoRedraw(long) (in libwx_osx_cocoau-3.0.0.3.0.dylib) + 857 [0x1057ef819]
I discussed with Apple and they don’t think it’s hardware or OS related and suggest to find help in library’s forum. Does anybody have the same issue? Can anybody give me some hint on how to improve my app on bad Macs?