Tags

, , , ,

Normally Windows does not limit local handles as long as system resources allow. However, C run time have default of 512 per process. In fact, handling even so much is not a good idea, and generally indicates a problem in program architecture. A simple solution may be pooling. In rare cases of inevitable need, such as concurrent multi channel operations, there is a pair of functions for use int _getmaxstdio() and _setmaxstdio().

Resource shortage may reveal itself as a failure to open() request with strerror(errno) to be Too many open files. In Windows, it is usually possible to increase this value to 2048.

increasing file handles - solution for windows

increasing file handles - windows handle increase

In Linux, we may see the system limit with ulimit -n,

increasing file handles - linux displaying file limit

Increasing this requires modification of nofile field in /etc/security/limits.conf.

increasing file handles - solution for linux

Changes will be effective with new session / login.

increasing file handles - linux displaying file limit after increse

Advertisements