You should be able to use
```js
styleFunction = goog.functions.constant(styles);
```
here, which will allow the JS VM to free the scope of the call to `ol.feature.createFeatureStyleFunction`.