My program fills memory. Is there another approach?
<p>I know that the object refguess becomes 95^n characters long and that's what's being stored in the memory. Is it possible to load and iterate one element into memory at a time, erasing it before loading a new element? Eventually, I want to port this to run on a GPU to take advantage of the shader cores' superior number crunching ability, so a small RAM footprint would be optimal.</p>

<pre><code>import itertools
import string

i = 1
refguess = ''
password = ' ~}}'
charlist = list(string.printable)
charlist = charlist[1:95]

while refguess != password:
    i += 1
    for idx, val in enumerate(list(itertools.product(charlist,repeat=i))):
        refguess = ''.join(map(str,val))
        if refguess == password:
            print('Password is ' + '(' + refguess + ')')
            break
</code></pre>
