Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

googled a lot but cant find a working answer...
from using 'pointers' to 'gc.collect'...

how hard can it be to wipe the memory once the string variable isn't used anymore?

for the time i put a dummy value and the end of the procedure. But is this a good & effective way of doing?

What I have tried:

googled on wiping memory & using or not using gc.collect
Posted
Updated 26-Feb-16 8:54am

Basically, you can't - strings are immutable, and you can't change them in any way.
Instead, use this: SecureString class[^] - it's nowhere near as flexible, and it's truly a pain to show its content to the user, but...
 
Share this answer
 
Quote:
How do I wipe string variable value from memory
VB have automatic memory management. You can consider that the memory/garbage management is doing it for you automatically. You have nothing to do.
Quote:
for the time i put a dummy value and the end of the procedure. But is this a good & effective way of doing?
Basically, no need, not necessary, because the new value will not overwrite the old one.

Do you have a special reason to want to do this ?
Quote:
Why Ii want to this? To protect data from being read in memory by ... unallowed persons/programs/viruses etc...
In this case, don't use VB, use a language that allow you to manage memory manually and wipe data before releasing the memory.
 
Share this answer
 
v2
Comments
CDRxxx 26-Feb-16 16:21pm    
Why i want to this? To protect data from being read in memory by ... unallowed persons/programs/virusses etc...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900