Re: I-4GL: Dirty memory (uninitialized variables)
Posted in 1998
John Bitsche <john.bitsche@wholefoods.com> wrote: >Nope. [...omitted in the interests of brevity...] > >I'm a-talking about Informix-4GL. We ported a big-honkin' legacy 4GL >(FourGen-based) app from a DG box to a SUN, and are discovering that the >legacy code has a lot of uninitialized variables in it. At random, >these uninitialized variables show up with leftover garbage in them >(because the malloc got some pre-used mem). > >Apparently either the DG OS or the compiler was nice enough to clean out >memory before handing it off to the 4ge programs, so we never >experienced the prob on the DG box. Now that we're on the SUN,... > >Not wanting to resort to running all programs as 4gi only, I am looking >for a good idea on how to get "pre-cleaned" memory for the 4ge >programs. The other alternative, hunting down all uninitialized >variables, would be a long, long nightmarish experience. It sounds as if you were using p-code on the DG box? If so, the problem is that the only difference between p-code and c-code is in the behaviour of uninitialized variables. P-code protects you by quietly initializing them on entry to zero or null; c-code leaves you with whatever garbage happens to be left over from the last time the memory was used. If you've only developed with p-code, then the only sensible tactic is to deploy p-code only -- or clean up and only ever use initialized variables. I agree about the difficulty of doing the clean up. Yours, Jonathan Leffler (jleffler@informix.com) #include <disclaimer.h> PS: when I said "the only difference *is*", I should really say "the only difference should be"; any other differences are almost certainly bugs.