We investigate a variant of the octahedron recurrence which lives in a 3-dimensional lattice contained in [0,n] x [0,m] x R. Generalizing results of David Speyer math.CO/0402452, we give an explicit non-recursive formula for the values of this recurrence in terms of perfect matchings. We then use it to prove that the octahedron recurrence is periodic of period n+m. This result is reminiscent of Fomin and Zelevinsky's theorem about the periodicity of Y-systems.