A nonstandard free boundary problem arising in the shape optimization of thin torsion rods