Application for such a discharge must be made, by the petition of the insolvent, addressed to the county court of the county in which he resides; or, if he resides in the city of New York, to the supreme court.