Avoiding GC when rebuilding Mesh.uv and Mesh.vertices

Since unity will not allow users to iterate over mesh.uv and mesh.vertices, I am stuck having to use GC intensive calls when applying an array of uvs and vertices to a mesh. I run into high GC allocation because every time I rebuild a mesh, the uv and vert arrays will be a different size due to the mesh being modified. In turn, this results in having to resize or create new uv/vert array and that is where the garbage collection comes in to be a problem when the old array or list is discarded as well as when applied to the mesh.

Example 1 - List:
For example, building a List UVList for a mesh that is built frequently will require calls of UVList.Add(Vert), this creates garbage for the GC whenever the List is resized because when the list is resized, it creates a new copy and the old copy goes into GC. Also, to apply this list to a mesh.uv requires the call UVList.ToArray(); which is a nasty call that creates huge GC if you have a long list of vertices because again, to convert to array, that array after it is copied mesh.uv = UVList.ToArray() the UVList array created goes to GC.

Example 2 Array:
I’ve instead tried using fixed array sizes but then learned that you cannot iterate over vertices or uv array of a mesh. For example, using a for loop to directly apply a vertices array to mesh.vertices will result in no mesh showing (i.e. for(i = 0; …){ mesh.uv = uvArray*;} )*
If I cannot do this, then I run into the same problem as example 1, because the only way is to create new array every time you want to update your mesh that has diff uv/vert length. Resizing array requires creating a new copy of it, and then you have the same issue with GC.
I tried reading through this example of someone else dealing with Unity GC when frequently updating meshes C# memory and performance tips for Unity
He doesn’t really explain his helper method in applying the UVs to the mesh and when trying from his example, it also results in GC.
I guess my question is, how can I frequently update a mesh with diff uv/vert array size without running into GC Alloc slowing down my project?

If you use a recent Unity version you now have methods like SetVertices, SetUVs, SetTriangles which directly takes a List which is passed directly to the native engines core. So no garbage will be created at all. If you create your lists large enough the internal array never need to be resized:

List<Vector3> verts = new List<Vector3>(65536);

When you use an older Unity version where those methods don’t exist you might want to use a fixed size array as well and just cache it. The array might have left over elements but those usually don’t hurt much. You can still use a similar approach to List.Add by doing it manually:

Vector3[] verts = new Vector3[SomeConstantSize];
int currentIndex = 0;
void Add(Vector3 aVec)
{
    if (currentIndex < verts.Length)
        verts[currentIndex++] = aVec;
}

ps: I Just realised that with SetUVs it seems that Unity finally supports Vector4 uv coordinates. So we might finally be able to use perspective correct texture mapping