Add a release method on DeclarativeItem class to fix leaks