Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to write large numbers to a file without process not being frozen or killed by OS?
    primarykey
    data
    text
    <p>In a C++ program (Linux), I need to write some numbers (integers, one number per line) to a file, and the size may be very large (currently 25GB). </p> <p>The numbers are 1 , -1 or 0, which are used to record the connections of node and arc in a large graph. </p> <p>all the output is written to a file (.txt) by std::ofstream &lt;&lt; ...</p> <p>The printing code architecture is : </p> <pre><code>for loop1 (node size) for loop2 (arc size) filename &lt;&lt; ....... </code></pre> <p>If the output size is small, it works well. </p> <p>But, when the output size is large, the shell terminal where the programming is running is frozen.</p> <p>But the process is still running and after long time (hours) it is killed by OS.</p> <p>No errors, warnings, segmentation faluts pop up.</p> <p>What are the possible reasons ? </p> <p>I tried to search it online, but do not find what I need. </p> <p>Thanks</p> <p>This is the output of ulimit -a</p> <pre><code>core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 399360 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 399360 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited </code></pre> <p>in top command: It used &lt; 200 MB . </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload