Re: Bug in STRMID system routine [message #82475 is a reply to message #82473] |
Thu, 13 December 2012 11:48  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Heinz Stege writes:
> strmid needs a bug fix. When I start with a very long string
> a=string(byte(randomu(seed,1024^2*10)*(127.-32.))+32b)
> and then extract a short substring
> b=strmid(a,1,2)
> the result b needs 10 MB of memory. As much as the original string a.
>
> This overhead of memory can be released by a statement like b=b[0] or
> b=b+''. However this is only a workaround and should be fixed in the
> system routine itself.
>
> A demo is attached below.
I ran the demo on a Windows 7 64-bit OS with IDL 8.2.1.
It appears the bug is fixed, because the example with
a small string took a small amount of memory, rather than
the large amount you report.
The last example, though, completely and utterly locked up
my machine. No Task Manager, no nothing, requiring a hard
reboot and cost me about an hour's worth of work. Not too
excited about that. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|