Goldenseal Pro- Memory Sleuthing #2 (Sept 4)

As mentioned in the last post, we recently switched to a newer memory management system (ARC). That caused a crash after opening list windows. Switching back fixed it temporarily, but we want to use the newer system. Unfortunately, there weren’t many clues to help solve the problem.

One good approach for mystery errors is to eliminate details, and make the setup as simple as possible. We gradually removed everything from the window, but even when completely empty, it still crashed. A brand new empty window also crashed. That was good progress, actually, since it eliminated many possible culprits.

Many of the accounting screens have More Info buttons that show a smaller window that contains more fields. It uses very similar code, and it still works fine. We copied that window, but it crashed. Then we copied all the code that creates it, and it worked OK. Yesterday we changed that working version bit by bit, until it crashed. Then went back a step, and finally got lists working again. It’s not 100% clear why it was breaking, but at least we know approximately how to fix the error, if it happens again.

We use C++ for most of our programming. It’s a programming language with a reputation for being very hard. One reason for that is because the programmer needs to manage memory. It requires care and skill to avoid crashes and memory leaks.

Many newer languages are ‘easier’, thanks to built-in memory management. The Cocoa library also does that with ARC.  It sounds great in theory, to have software that manages memory for you.

I think the best analogy here is that C++ is like a regular car or truck with a stick shift. Hard to learn, but reliable once you learn it. It does what you expect. Cocoa, Java, and other modern languages are like a self-driving car. It’s way easier, and practically lets you snooze while on the road. But occasionally the system won’t see a stationary bus, and you’ll drive into it at full speed. That’s pretty much what happened, the past couple weeks.

I think we will stick with ARC, because it is working fine otherwise. Maybe we won’t hit many more stationary buses.  Or we will get good at spotting buses on the horizon.

The Cocoa library for Macintosh can be extremely frustrating, but sometimes it works like a dream. For example, Interface Preferences has a couple of popup buttons that show a lists of fonts. It took about 30 lines of code to get it working in the original Goldenseal. We did a quick search, and copy/pasted two lines of code. It now shows a standard font dialog. Cool!

Meanwhile, we are going through each data entry window, and fixing the occasional problem or missing feature. For example, bank transactions currently shows a running total on the left side of the window. Goldenseal Pro uses that space for the outline view, so it can’t go there. However, we have a bottom bar similar to Excel’s, and it’s the perfect place for that kind of text. It has been empty for quite a while, but now it shows useful text. We also added a built-in progress bar to replace the current window.

Running a construction business is complicated. Estimating and accounting are complicated. That makes Goldenseal a complicated program. There are many quirks to get working again. The good news is that most of them are easy to convert. They are close to instant gratification.

Dennis Kolva
Programming Director



Author: Dennis Kolva

Programming Director for Turtle Creek Software. Design & planning of accounting and estimating software.