So long as you didn't receive a Desk Appearance Ticket, NYPD likely did not release you from jail - a judge did. If so, if there is an order of protection against you, make sure you don't violate it.
For informational purposes only. No attorney/client relationship exists.
This is a tricky question you are asking. It is not a matter of can they rather than a matter of will they. As counsel answered you most likely were released by a Judge. If there was an immediate and clear danger of a person hurting oneself the Judge would likely take action and send the person to a mental health facility to be monitored. The housing, clothes and money issue unfortunately would not incline a Judge or the police to keep a defendant in custody,
This is not legal advice or counsel to any specific case or matter that you may have pending in any court. This is a general answer with the intention to provide some general information on a specific topic. Any answers to these questions are not protected by the attorney client privilege. An attorney should always be consulted and/or retained if you are looking for advice specific to your case.
NYPD makes arrests and the decision to prosecute is in the hands of the local prosecutor and judge. You do not indicate you were brought before a judge or that you ever made it to central booking so an answer is not clear cut. You do have a civil option and can sue your exBF and take him to landlord tenant court.
The advice I have given does not bind the parties in any manner and is merely given as a courtesy.