Recent

Author Topic: SOLVED: Truly cleanup a string  (Read 4617 times)

ezlage

  • Guest
Re: Truly cleanup a string
« Reply #15 on: May 23, 2018, 11:51:59 pm »
correction :
please use Word(s[0]) instead of Integer(s[0]) because if the length goes below #127, Integer transtyping would give negative values

I did as you suggested, but unfortunately it did not work. Anyway, thank you. My thanks also to Bart, as he gave me a suggestion too and I forgot to thank him.

Fiz o que me sugeriu, mas infelizmente não funcionou. De toda forma, obrigado. Meus agradecimentos também ao Bart, pois ele me deu uma sugestão também e eu esqueci de agradecê-lo.

ezlage

  • Guest
Re: Truly cleanup a string
« Reply #16 on: May 24, 2018, 08:56:11 pm »
I finally figured it out.

The string memory clear commands were working. The value only appeared in the dumps because some copies were passed as a parameter or as result of functions.

I rewrote the functions as procedures using the "var" qualifier. Example: procedure DoSomething(var str: shortstring);

Now all functions and procedures work without copying the string, so you can clear it from memory before it goes out of scope.

=== In Brazilian Portuguese ===

Eu finalmente descobri.

Os comandos de limpar a memória da string estavam funcionando. Os valores só apareciam nos dumps porque algumas cópias eram passadas como parâmetro ou como resultados de funções.

Reescrevi as funções como procedimentos, utilizando o qualificador "var". Exemplo: precedure DoSomething(var str: shortstring);

Então, todas as funções e procedimentos funcionam sem copiar a string, sendo possível limpá-la da memória antes que saia do escopo.
« Last Edit: May 24, 2018, 09:07:31 pm by ezlage »

 

TinyPortal © 2005-2018