Tendon locking
Small animals which sleep in trees or caves usually hang on with their feet: they have a tendon locking device which keeps them hanging on even during sleep. It works by one tendon running down the leg shifting position slightly so it grips the tendon which closes the toes. Bats independently evolved a similar arrangement. Once the tendons are locked, the muscles in their legs and feet can relax. Even dead bats stay hanging. These various examples have evolved independently of each other: this is known from the fine details of the mechanism. One plus of a locking mechanism is that it allows attachment to slender branches on which predators might be unable to walk.