UE5 crashes when using FDynamicMesh3::AppendVertex

Hey everyone,

I am trying to setup a DynamicMesh using FDynamicMesh3.

In my header file I call :

FDynamicMesh3 *dynamicMesh

Then in the source file I use :

for (size_t x = 0; x <= sizeX; ++x)
	{
		for (size_t y = 0; y <= sizeY; ++y)
		{
			double zValue = perlin.octave2D_01(x * perlinScale, y * perlinScale, 8) * perlinAmplitude;
			FVector3d* vertex = new FVector3d(static_cast<double>(x), static_cast<double>(y), zValue);
			dynamicMesh->AppendVertex(*vertex);
		}
	}

As soon as I try to compile, the editor crashes.

According to the crash logs, the problem seems to come from the Allocate function in UE::Geometry::FRefCountVector, which is called in AppendVertex.

Do you have any ideas why it’s crashing ?

Thanks,
Benji