Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Raster::Line segfaults ... sometimes. (Adding a static counter somehow fixes the issue (for me).)
Re: Raster::Line segfaults ... sometimes. [message #44078 is a reply to message #44076] Tue, 23 December 2014 09:24 Go to previous messageGo to previous message
rainbowsally is currently offline  rainbowsally
Messages: 29
Registered: December 2014
Promising Member
Hi Didier.

Didier wrote on Mon, 22 December 2014 20:34
Hello Rainbowsally,

Quote:
And just adding a static counter fixed the problem.
Huh????
.
When you encounter such behaviour : modification of an unrelated code that causes a correction (or a crash), this is mostly due to uninitialized variables ( somewhere in the code .... ).
I recommend launching valgrind on this : info should be very instructive.


I'm using Linux Mint 32-bit with 64 bit dual core CPU.

The problem was intermittent after I included the static variable and counter (to use it so it couldn't be optimized out).

I ran it in an external debugger (kdbg) and it never crashed. This lack of crashing in the debugger but crashing from the command line or when clicked with a mouse suggested to me that it might be a problem with thread timing.

Thank you for the note and an opportunity to describe the situation more fully.

IF you guys are experiencing intermittent crashes with multithreading apps, do consider passing control back to the operating system from time to time using a simple Sleep(1) or usleep(N) inside the thread's "run" loop.

Easier to disable multi-threading? True. But that may not be necessary.

The Raster example code has been around for so long it seems very very unlikely that it's a memory leak, although that could account for the variables being set up by previous calls if the memory is not re-initialized. But that then begs the question of how the first app crashed and left its variables set and the second app failed to overwrite them.

Smile

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Multithreaded Animated GIF
Next Topic: Sound in linux
Goto Forum:
  


Current Time: Sun May 12 16:11:07 CEST 2024

Total time taken to generate the page: 0.03857 seconds