comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Error: Array has a corrupted descriptor
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Error: Array has a corrupted descriptor [message #51554 is a reply to message #51552] Tue, 28 November 2006 09:16 Go to previous messageGo to previous message
gqshen2008@gmail.com is currently offline  gqshen2008@gmail.com
Messages: 9
Registered: October 2005
Junior Member
I agree, that does make sense since IDL must use MALLOC routine
internally (I assume IDL is written in C) to claim the memory any time
the size of array changes, and constantly changing it will fragment the
memory like crazy as you said. However, I have modified my code to get
rid of the BYTARR line and keep the dynamically modifying array line,
and the program doesn't crash now.
I am really confused here and hope someone can be the myth-buster.

P.S. IDL gives me the impression that it is not a big fan of the idea
of constantly changing a complex strucuture like array or an unsigned
long which are over 1,000,000 since it will srew up the content of the
variable, sometimes. My suggestion is to make a temporary variable to
avert the burden. I would like to hear a better idea to deal with this
kind of situation.

Best regards,
Gongqin

David Fanning wrote:
> Gongqin Shen writes:
>
>> Thank you for paying attention to my question. Bascially, "do
>> something here" is just some basic array manipulation like:
>> arr = arr3D[1:2, *]
>> arrInd[0, *] -= a
>> arrInd[1, *] -= b
>> arr[arrInd] = 1B
>> aLabeled = Label_Region(arr)
>>
>> FOR j = 1, MAX(aLabeled) DO BEGIN
>> ithIdx = (WHERE(aLabeled EQ j))[0]
>> outputList = [outputList, ithIdx]
>> ENDFOR
>>
>> I hope your eagle eye can find out where the glitch comes from. :-).
>
> I think the likely suspect is this line:
>
> outputList = [outputList, ithIdx]
>
> At the *very* least, I would write this line like this:
>
> outputList = [Temporary(outputList), ithIdx]
>
> But I think you might be better off making output list as big
> as you need it (or bigger) and then filling it. I suspect
> the constant recreating of this array is fragmenting memory
> like crazy and resulting in your problems.
>
> void = Where(aLabeled GT 0, count)
> outputList = Lindgen(count)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Error: Array has a corrupted descriptor
Next Topic: natural neighbor interpolation

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 03:33:12 PDT 2025

Total time taken to generate the page: 0.87878 seconds