How can you copy (clone) a string?
piet at cs.uu.nl
piet at cs.uu.nl
Thu Oct 5 04:56:30 EDT 2000
>>>>> Greg Ewing <see at my.signature> (GE) writes:
GE> Peter.Rupp at ual.com wrote:
>>
>> What I'm trying to do is determine how large a user process can be
>> before it runs out of memory.
>>>> a = 1000 * 'a'
>>>> b = 1000 * 'a'
>>>> id(a)
GE> 1052344
>>>> id(b)
GE> 1091800
>>>>
GE> Loop until done.
That will not help, as the strings will be garbage collected.
i = 0
s = 1000 * 'x'
mem = None
while 1:
i = i+1
mem = (mem, s+`i`)
might work (untested)
--
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl
More information about the Python-list
mailing list