I also don't know if there is any study on this matter, but my guess would be that they don't feel sexual inhibition more than other animals. As a personal experience, I was once at a Zoo and a male monkey was masturbating in front of everybody (both people and other monkeys).
I also saw a documentary on TV presenting the sexual behaviour in some primates (I thinks it was baboons, but I don't remember exactly) and showing a female during her heat that was simply passing by every male in the group and challenging them to intercourse.
I do not know but it is probably sexual abstinence ... in the absence of many experiences which in a small environment which is cage / small space /, causes such other behaviors .... Similar behavior masturbation is noticed in mentally handicapped people where not There are many inhibitions ... but please ask sexologists or psychiatrists because there are attempts to solve this problem