I don't know of course, but I'd take a bet that this could be written using less physical memory. The input file of course does not need to be resident, the output file might be written in small chunks - just speculation!The Rust program I wrote works very well in Raspberry Pi5. The problem is the size of the files it uses. Those text-files are 6GB and 11GB therefore doesn't fit in the RAM.
mmap() could perhaps be useful.
Swap is enabled by default, but its small - 100Mb. The suggestion in your other post simply increases its size.A swap-file is needed, but a swap-file is not enable as default in Raspberry Pi OS. That was what I was asking about.
Note that Linux might use swap for other things than large virtual memory programs - such as moving infrequently accessed (mutable) stuff out of main memory.
See "free -h" for a summary of swap used, also "vmstat" for running details.
Wow! I wish it could fix the bugs in my codeWhen you try to test a program and get errors, all defined errors are automatically fixed, through cargo fix.
If memory is an issue, note that rust programs are very large compared to C programs:
Code:
$ rustc hello.rs$ ls -lh hello-rwxr-xr-x 1 pi pi 12M Apr 29 08:44 hello$ strip hello$ ls -lh hello-rwxr-xr-x 1 pi pi 323K Apr 29 08:44 helloCode:
$ gcc hello.c -o hello$ ls -lh hello-rwxr-xr-x 1 pi pi 69K Apr 29 08:46 hello$ strip hello$ ls -lh hello-rwxr-xr-x 1 pi pi 66K Apr 29 08:46 helloAlso comparing the assembler code produced by the two compilers might show another reason for the large sized rust executables.
For fun, even C is huge compared to assembler ...
Code:
$ as hello.s -o hello.o$ ld hello.o -o hello$ ls -lh hello-rwxr-xr-x 1 pi pi 992 Apr 29 08:53 hello$ strip hello$ ls -lh hello-rwxr-xr-x 1 pi pi 384 Apr 29 08:53 helloStatistics: Posted by jahboater — Mon Apr 29, 2024 7:38 am