Write your own MemMananger? Like Heaptrc.
That would NIL all allocations, not just strings. More performance impact, but also more secure since possible buffers are also nilled.
But any zeroing strategy relies on that no unnecessary strings (or buffers containing them) are kept alive, e.g. setting fields that are no longer needed to '' etc, zeroing static buffers, and setlength()ing old buffers.
This should also allow to catch mem-realloc => in case the string grows.
If reallocing a string allocates a new string, decref is called on the old one. astrings.inc:808 in trunk
Note: The OS may allocate memory and hold data belonging to TEdit. => that memory will not be cleared. If you want to be sure of that too, then use a custom-drawn input.
Yes, strings might exist in OS/widget structures too.
P.s. I'm not really a programmer with security aspirations or experience. This is just what I can think of quickly