Freeing / replacing a string variable, how is it handled?

Let's say I save the password as plain text in a variable passWdas a string. How does python free this variable after dropping it (e.g. with del passWdor passWd= 'new random data')?

Whether a string is stored as a byte array means that it can be overwritten in the memory that it originally existed, or is it a fixed set in the memory area that cannot be changed, and when a new area is used to check the new value memory is created and the old area is freed, but not overwritten by a zero value?

I wonder how Python implements the security of memory areas and would like to know more about this, mainly because I'm interested :)

From what I have collected so far, using del(or __del__) forces the interpreter to automatically free the memory areas of this variable, which may cause problems, and I'm not sure if del is the way to remove values. But this is only what I put together, and not something in black or white :)

The main reason I ask, I am going to write a portable application that receives a string, performs some I / O, passes it along with another subsystem (for example, a bootloader for raspberries pi) and the interface is written in Python (how strange it should be sound in the ears of some peoples ..), and I'm not worried that the data is compromised during I / O calculations, but that a memory dump can occur between two transfers of subsystems. or if the system is frozen (say, hopelessness), say, 20 minutes after the system boots up, and I deleted the variable as quickly as I could, but somehow it is still in memory, despite what I'm doing del passWd:)

(Ps. I asked the Superuser, they wrote me here, and I'm sorry for the bad grammar!)

+5
2

, , . .

, , . , , , ( ).

. , , .

+2

, . ld_preload, Python . , , C, , , Python .

C shread(), , , .

, @Ber , , ( ) Python, python ​​ (, , , ).

0

All Articles