| [ Return to Bugs & Features | Roadmap 1.1 | SVN ⇄ GIT ]
STR #333
Application: | FLTK Library |
Status: | 1 - Closed w/Resolution |
Priority: | 5 - Critical, e.g. nothing working at all |
Scope: | 2 - Specific to an operating system |
Subsystem: | MacOS |
Summary: | Fl_mac.cxx patch for leaking CreateEvent() |
Version: | 1.1.4 |
Created By: | greg.ercolano |
Assigned To: | mike |
Fix Version: | 1.1.5rc1 |
Update Notification: | |
Trouble Report Files:
Trouble Report Comments:
|
#1 | greg.ercolano 20:33 Apr 03, 2004 |
| See patch against 1.1.4 (attached).
This bug is experienced ONLY by OSX apps that use Fl::add_fd().. probably a rare combination.
I noticed the following code in the 'dataready_thread()' function in Fl_mac.cxx creates an event with CreateEvent() that is not released with ReleaseEvent():
---- static void *dataready_thread(void *userdata) { EventRef drEvent; CreateEvent( 0, kEventClassFLTK, kEventFLTKDataReady, 0, kEventAttributeUserEvent, &drEvent); EventQueueRef eventqueue = (EventQueueRef)userdata; ----
This appears to be leaking resources, as each time the code is called, drEvent gets larger.
The fix is to re-locate the above 4 lines of code down to the 'default' switch, so ReleaseEvent() can be called immediately after the message is sent, eg:
---- default: // DATA READY { DEBUGMSG("DATA READY EVENT: SENDING\n"); EventRef drEvent; CreateEvent( 0, kEventClassFLTK, kEventFLTKDataReady, 0, kEventAttributeUserEvent, &drEvent); EventQueueRef eventqueue = (EventQueueRef)userdata; PostEventToQueue(eventqueue, drEvent, kEventPriorityStandard ); ReleaseEvent( drEvent ); return(NULL); // done with thread } ----
See patch.
| |
|
#2 | mike 08:15 Apr 06, 2004 |
| Fixed in CVS - the anonymous CVS repository will be updated at midnight PST. | |
[ Return to Bugs & Features ]
|
| |