When working with an application for a long duration suddenly the application crashed.
On analyzing the reason for the crash it is found that the “User Objects” exceeded the limit(10,000 objects). So how to find which code part is responsible for the crash. It’s not so obvious, the profiling tools just give us the numbers but doesn’t show what objects are there. So, it was a hard way to debug through the whole “UI code”(Presentation Layer) while performing the the similar tasks in application which led to the crash and monitoring the “User Objects” count.
Finally found that the culprit is an “array of user controls” where the array is cleared but the objects in the array are not disposed properly.
There was an error reported that the application doesn’t recognize the “group” field in the table if it is the first column. And if this field is moved to the second column or beyond the the application works as expected.
We first suspected that there is a problem with the table file and spent time in analyzing the integrity of the file using various tools, but the efforts were in vain. So, I started debugging the code to understand how the application is building the group field from the table file.
The below part of the code was responsible for this wired behavior, this could have been eliminated if the function was unit tested.
if(group_position && group_length)
As C++ is a weak typed language, the if construct accepts integers as parameters.