nwixsom / gwt-cal

Automatically exported from code.google.com/p/gwt-cal
0 stars 0 forks source link

memory leak on every redraw with appointments in view #174

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Memory leak on every doLayout() in DayView.addAppointmentsToGrid() and 
MonthView.layOnAppointment(). AppointmentWidgets are registered to the 
dragController, but never released. References kept in RegisteredDraggable 
objects in MouseDragHandlers dragHandleMap leave AppointmentWidget and all 
objects it references outside of reference counting garbage collection.

Steps to reproduce and verify:

1.open calendar in day view in Chromium, create an appointment
2.open the developer tools, take a Heap snapshot at the "Profiles" tab
3.get the doLayout() firing, change the view date back and forth for example 10 
times but so that the appointment is always in view
4.take another Heap snapshot at the "Profiles" tab
5.view the second heap snapshot in "Comparison" mode
6.find the "AppontmentWidget_0" object and check the delta column, you will 
notice that none have been deleted
7.check the "Object's retaining tree" to see that the reference is kept in a 
MouseDragHandler$RegisteredDraggable_0

Fix:

deregister the widgets from the dragController.

The attached patch to trunk/gwt-cal/ keeps the dragController registered widget 
refrences and deregisters them on the next doLayout(). Also the 
AppointmentWidget has to implement HasTouchStartHandlers and 
HasTouchEndHandlers because the MouseDragHandler.makeNotDraggable(Widget 
widget) will otherwise fire null pointer exceptions.

Original issue reported on code.google.com by ville.fr...@gmail.com on 7 Feb 2013 at 10:04

Attachments:

GoogleCodeExporter commented 9 years ago
Patch applied in rev 444

Thanks a lot Ville.

Original comment by ctasada on 22 Feb 2013 at 5:45