del data[:]
As far as I know, this line would not have the desired effect of clearing the data memory. The slice notation Python makes a copy of the data. So that's not what we want. To fit in with the rest of the code and allow old data to be garbage collected, just assign an empty list to the data variable.