Fill memory with random data

Is there a way to fill in free RAM on a Linux machine with random data?

The reason I ask: I work in a group where we program numerical programming in Fortran. Sometimes people randomly work with double-precision actions, so programs that should give double-precision results give only the same accuracy.

If my understanding is correct, you can see random fluctuations in the result after a single limit of accuracy in such a program. That is, if you run the same program with the same input several times, each time you get a random result. What you see (random part) depends on random values ​​in the free RAM of the machine. But in practice, if you run the program again on the same computer, the same parts of the memory are usually reused that have the same random data in them, each time outputting the same output.

My idea is that if you could overwrite the memory with random data, you really will see random fluctuations in the output of your program. This would make it much easier to find these errors.

Is this idea a blow, and if not, how can I fill my memory? Can I plug in / dev / random in RAM or something else?

+5
source share
7 answers

Linux provides you /proc/pid/mapsand /proc/pid/memfor your enjoyment. Of course, you have to be very careful when writing there. Also, keep in mind that the only memory segment available to each process is its own, so you may have to bind and copy the code a bit to get to where you want. Good luck anyway. :)

edit: it is still several times more complicated than code auditing, which is also more likely to identify the actual source of the problem.

+2

. , , , .

Fortran , 32- . , , 32- . , , 32- . "" .

, . 1.0 / 3.0 + 1.0 / 3.0 + 1.0 / 3.0) , 0.99999... .

, Linux, . , - , : . EDIT: , , - .

(: , , .)

+5

( >= 2.4, ) glibc, MALLOC_PERTURB_, malloc() , ​​ . . http://udrepper.livejournal.com/11429.html http://people.redhat.com/drepper/defprogramming.pdf

, Fortran glibc malloc(), , Fortran.

+3

, - fUnit, , , , , .

: , , , , assert().

+2

, , , , Wile E. Coyote roadrunner, .

, , , . , , fortran, , .

- . , .

+2

, . ? , .

FORTRAN , " " ? , .

, Linux .

+1

ito , . , , , , .

,  -  -  - ,

; , , ; . .

+1

All Articles