Prevent memory leaks in views.