NativeList Caching and Disposing

Hi All, I have a procedural mesh generation system that asynchronously caches VertexData structs and Indices into NativeLists through the Job system and a compute shader. I then use that cache to generates per frame frustum culled meshes. The cache can be regenerated anywhere between every 5 frames to 50+ frames. This all works fantastically well and the performance is great (Burst is a beast).
The question I have is it safe to use the NativeLists as a data cache. They are Disposed of OnDestroy and this doesn’t seem to pose an issue. But every time I regenerate the cache I get the usual, A Native Collection has not been disposed, resulting in a memory leak, in the Console.
Is this an issue?
Cheers

1 Like

Ok, In writing the question and going the the logic I answered my own question. While I have the Job cached I still need to Dispose of the NativeLists every regeneration.
Sorry for making you look. :slight_smile:

1 Like