Working trend graph but huge memory leak