Since the beginning of the QiQA prototype development I have been battling with a weird problem. The application just ended unexpectedly while processing some drawings during database building. However, I never had the opportunity to study this problem properly. Instead I choose to skip the problematic drawings, flagging them as "nor processable".
Fortunately, thanks to recent improvements in the feature extraction algorithms, the drawing processing is much faster than before (at least ten times faster). Thus, I decided to focus on the above referred problem.
After identifying a drawing that triggers the above referred error, I patiently started to debug the code. After several boring hours of detailed analysis, I finally found the portion of the code that causes this damned error.
It was during the access to a list within the CALI code, developed by Manuel João da Fonseca. When the given index value is outside the valid bounds, this library simply calls the C++ "exit" function. And that's it. But why and when does this happen? During the computation of convex hull of the "CIScribble".
Indeed, it seems to be missing a test in the "while" sentence, which allows a variable with a unacceptably low value to be used as index to access a list. Therefore, for now the solution was just adding a test to the "while" test expression and voilá... it works fine.
"AFj's PhD" blog was created in 2004 to report on-line the PhD work of Alfredo Ferreira (Jr). After finishing his PhD in July 2009, the posting was suspended.
However, after several requests, the blog was reactivated in October 2010."AFj's PhD and after" blog will provide information on Alfredo Ferreira's work as a researcher in INESC-ID and his activities as a Assistant Professor at IST/TULisbon.
Showing posts with label Debug. Show all posts
Showing posts with label Debug. Show all posts
Wednesday, February 06, 2008
Tuesday, November 27, 2007
It was just a 'void' !!!
When I compiled a small application I wrote in C++ in Release Mode, the resulting 'exe' file crashed unexpectedly. Indeed the same code compiled in Debug Mode works fine. Initially I thought that it must be due to some failures in variables initialization, but no. When coding, I am usually very careful with that details.
I spent the whole afternoon trying to solve the problem. After a while I had already located the problem. The error occurs when accessing a list. Then I just had to figure out what I did wrong and solve it. But this apparently simple task was indeed a hard challenge. Finally, when I discovered the problem I was astonished by how strange it was.
I am using a list of pointers to instances of a class I defined. However, when I created the class, it was like this:
class MyClass : public {
(...)
MyClass();
(...)
}
Here, the class constructor does not have any parameters. It works perfectly fine in Debug Mode but it generates an error in Release Mode when using a list of pointers to this class. The solution was simple. I just have to change the constructor as depicted below.
class MyClass : public {
(...)
MyClass(void);
(...)
}
Damn! So much time lost because of a simple 'void'. Damn!
I spent the whole afternoon trying to solve the problem. After a while I had already located the problem. The error occurs when accessing a list. Then I just had to figure out what I did wrong and solve it. But this apparently simple task was indeed a hard challenge. Finally, when I discovered the problem I was astonished by how strange it was.
I am using a list of pointers to instances of a class I defined. However, when I created the class, it was like this:
class MyClass : public {
(...)
MyClass();
(...)
}
Here, the class constructor does not have any parameters. It works perfectly fine in Debug Mode but it generates an error in Release Mode when using a list of pointers to this class. The solution was simple. I just have to change the constructor as depicted below.
class MyClass : public {
(...)
MyClass(void);
(...)
}
Damn! So much time lost because of a simple 'void'. Damn!
Subscribe to:
Posts (Atom)

