Why can I open only 2045 files with Tie :: File on Windows?

I have the following code that is trying to associate arrays with files. In addition, when I run this code, it only creates 2045 files. What is the problem?

#!/usr/bin/perl
use Tie::File;

for (my $i = 0; $i < 10000; $i++) {
    @files{$i} = ();
    tie @{$files{$i}}, 'Tie::File', "files//tiefile$i";
}

Edit: I'm on windows

+3
source share
2 answers

You accumulate open file descriptors (see. ulimit -n, / ), And you will eventually reach the limit of open file descriptors to 2048 (2045 + + + .)setrlimit RLIMIT_NOFILERLIMIT_OFILEstdinstdoutstderr

Windows , 2048 , 2048 - ( ) MSVC stdio.

+14

Linux /etc/security/limits.conf

* soft nofile 10003
* hard nofile 10003

, 10003 (, : stdin, stdout stderr).

, Win32. , , , fork 'ing ( Win32).

+2

Source: https://habr.com/ru/post/1705372/


All Articles