Extremely Strange Program Behavior [message #39489] |
Sun, 23 May 2004 11:15  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
I have a problem with a program that is exhibiting extremely
strange behavior. I just wondered if anyone has seen this
before.
I have a relatively complicated program that uses a great
many pointers and objects and widgets wrapped up in objects.
The program actually runs perfectly, as far as I can tell. It
does what it is suppose to do (restores some files, copies some data
out of stored IDL structures, puts up a graphical user interface
etc.) and when I exit the program there is no evidence of any
leaking heap memory. All very clean and tidy.
Now, here is the strange part. If I run the program again
immediately after I exit, the program crashes the IDLDE with one
of those dreaded "instruction at whatever couldn't read
memory at some other whatever" messages. (Which I am seeing
much more frequently, I think, since I upgraded to a new,
faster computer running Window XP, but that's another story.)
Here is the kicker. If I open a window between the time
I exit the program and start it up again, it will run
perfectly for as long as I care to run it!
Naturally, I can't make a simple "example" file that
exhibits this behavior, so the chance of getting someone
at RSI to look at it is probably awfully low. Does this
ring any bells for anyone? Does anyone have a theory as
to why opening a window would help solve this problem,
whatever it happens to be?
Thanks.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Extremely Strange Program Behavior [message #39517 is a reply to message #39489] |
Wed, 26 May 2004 02:07   |
Nigel Wade
Messages: 286 Registered: March 1998
|
Senior Member |
|
|
David Fanning wrote:
> Rick Towler writes:
>
>
>> Just out of curiosity, what processor is in this new machine?
>
>
> Well, I'm just borrowing this machine, really. But it is
> a Dell 8300 with a 3GHz Pentium(R) 4 CPU processor and
> 1GByte of RAM.
>
> I can't tell if it is because I am installing old
> software on it that is causing it to hang more often,
> or what. But I have definitely had the ol' Task Manager
> out more often than I did with my old Windows 2000 Pro machine.
>
> The machine came directly from the factory, and I immediately
> downloaded all the Windows updates that were required before
> installing any software. Maybe I did that in the wrong order. :-(
>
> The IDL thing, though, seems to be unrelated. It is
> extremely reproducible and I spent a day going completely
> through the code to see if I had done something unbelievably
> stupid. (Likely, but I sure didn't find it.) What do you
> do with a program that works perfectly, cleans up after itself,
> but won't run again unless you give it a fifteen minute
> coffee break? I've heard of union rules, but this is
> ridiculous. :-(
>
> Cheers,
>
> David
>
Have you tried running memtest86 to see if there is a hardware error? It's
just possible that running IDL twice in quick sucession is causing the
second execution to use higher physical memory addresses due to memory
management issues.
It's a reasonably quick test and might save a lot of head scratching.
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
|
|
|
Re: Extremely Strange Program Behavior [message #39536 is a reply to message #39489] |
Tue, 25 May 2004 10:54   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Rick Towler writes:
> Just out of curiosity, what processor is in this new machine?
Well, I'm just borrowing this machine, really. But it is
a Dell 8300 with a 3GHz Pentium(R) 4 CPU processor and
1GByte of RAM.
I can't tell if it is because I am installing old
software on it that is causing it to hang more often,
or what. But I have definitely had the ol' Task Manager
out more often than I did with my old Windows 2000 Pro machine.
The machine came directly from the factory, and I immediately
downloaded all the Windows updates that were required before
installing any software. Maybe I did that in the wrong order. :-(
The IDL thing, though, seems to be unrelated. It is
extremely reproducible and I spent a day going completely
through the code to see if I had done something unbelievably
stupid. (Likely, but I sure didn't find it.) What do you
do with a program that works perfectly, cleans up after itself,
but won't run again unless you give it a fifteen minute
coffee break? I've heard of union rules, but this is
ridiculous. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
|
Re: Extremely Strange Program Behavior [message #39568 is a reply to message #39489] |
Fri, 28 May 2004 12:34  |
Marc R. Reinig
Messages: 6 Registered: May 2004
|
Junior Member |
|
|
Another thought is that Windows can be slow in freeing memory and
resources after a program executes. If there are a lot of scattered
objects it may take it a while and reduce the amount available for a
second running of your program. I haven't seen this impact other
Windows programs, so I doubt it is the sole reason, but it might be a
contributing reason.
Also, I don't know how IDL works internally, but since it seems to
handle resources for the programs itself, it may be slow in releasing
things. All it takes is for a single reference to an object to keep it
in memory and unavailable to others.
However, the fact that, if you open a window (and I gather that would be
a Windows window as opposed to an IDL window) the problem goes away,
would tend to point to a Windows issue, since opening a window would
kick off a lot of cleanup activity, if there weren't enough resources
available (as opposed to putting the clean up in the background).
Programs will often request a resource, such as memory, but not check to
see if they really got it, then attempt to use it. Windows will
periodically fail requests for resources for various reasons. Programs
are supposed to check for this and handle things gracefully, like
retrying after a brief interval or issuing a message to the user. I
write drivers and it is necessary to handle these cases because they do
happen and when a driver doesn't handle things like this you usually see
a blue screen. Fortunately, user programs usually just die without
killing the whole system, if they don't handle things right.
You might look at the resources usage in the task manager and see if
this is what is happening.
Marc Reinig
Laboratory for Adaptive Optics
UCO, Lick Observatory
|
|
|
Re: Extremely Strange Program Behavior [message #39599 is a reply to message #39489] |
Wed, 26 May 2004 11:25  |
Marc R. Reinig
Messages: 6 Registered: May 2004
|
Junior Member |
|
|
You might check the size and location of the swap file on the machine
that works and the one that doesn't.
Marc Reinig
Laboratory for Adaptive Optics
UCO, Lick Observatory
David Fanning wrote:
>> Reproducible on other machines?
>
>
> Humm. No. Works perfectly on my other machine. Really
> odd. Maybe this explains my other lock-ups, too. That
> might make sense. Guess I'll have to do the memory
> check thing. Thanks,
|
|
|
Re: Extremely Strange Program Behavior [message #39604 is a reply to message #39489] |
Wed, 26 May 2004 10:23  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Rick Towler writes:
> Reproducible on other machines?
Humm. No. Works perfectly on my other machine. Really
odd. Maybe this explains my other lock-ups, too. That
might make sense. Guess I'll have to do the memory
check thing. Thanks,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Extremely Strange Program Behavior [message #39607 is a reply to message #39517] |
Wed, 26 May 2004 08:24  |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
"Nigel Wade" wrote...
> David Fanning wrote:
>> Rick Towler writes:
>>
>>
>>> Just out of curiosity, what processor is in this new machine?
>>
>> Well, I'm just borrowing this machine, really. But it is
>> a Dell 8300 with a 3GHz Pentium(R) 4 CPU processor and
>> 1GByte of RAM.
> Have you tried running memtest86 to see if there is a hardware error? It's
> just possible that running IDL twice in quick sucession is causing the
> second execution to use higher physical memory addresses due to memory
> management issues.
>
> It's a reasonably quick test and might save a lot of head scratching.
I would second this. The reason I asked was that the AMD Athlon64/Opterons
are very sensitive to RAM timings and more than a few times I have seen
"Etremely strange program behavior" as a result of marginally compatible
RAM. The P4's aren't as sensitive but you could have gotten a rotten stick
of RAM.
Download the bootable .iso and burn a CD. Boot to the CD and let the test
run while you get a cup of coffee or play some tennis.
>> The IDL thing, though, seems to be unrelated. It is
>> extremely reproducible...
Reproducible on other machines?
-Rick
|
|
|