This is happening in the U.S. too. Some of the counties are under court mandates around overcrowding in the jails. The goal is to have individuals in their communities but without any support, they often miss court dates or other obligations and then they get a warrant and end up back in jail in a worse position. Also, in this situation, the root cause of the arrest is never being addressed.
Right now in some cities in the South of Brazil the police have to let the arrested criminals go because there is no room for them in the cells.