Planting apple trees on terrace

I am going to plant dwarf apple trees( on G11 and G16) on a terrace that has 2.5’ drop(retaining wall) on east-north side.What is the minimum distance between the tree trunk and the edge of the terrace should be? Is 4’ enough, or roots can be damaged in winter by frozen stone wall?

I am far from an expert, but I planted seven dwarf trees behind a 2’ stone retaining wall. The wall is about 16" thick and the trunks are about 2’ in from the back edge of the stone in the wall. Their first two winters were near record cold in Boston, no problems with survival. I’m in zone 6b.

Yes 4ft should be enough. Roots can be killed by freezing. But in this case there would be enough roots away from the wall to keep the tree going just as well as if the ground were flat.

Thanks all, this is exactly what I wanted to hear!