Re: avoiding huge globals files
Posted in 1996
Topics: Performance & Tuning, Connectivity: ESQL/C, 4GL & Embedded SQL
Douglas Wilson wrote: > > Mark D. Stock wrote: > > > > Rudy Fernandes wrote: > > > I'm not suggesting that all variables must be globals, or local. But when > > values are to be shared, globals will give better performance, and less > > headaches for maintenance. I have had to debug other peoples programs > > where they passed strings from one function to the next to the next, etc. > > They wanted to know why they were getting error -4518, I said I didn't > > know but use globals and it will go away. ;-) > > > > And I forget what the error number is, but the one about running out > of temp string space keeps coming up for me unless I change the string > parameters to globals. Usually in the debugger. And following Murphy's Law, > usually near a critical break point. > > Douglas Wilson A couple solutions we've used to reduce this some: 1. All globals for applications will have two specific global string variables of reasonable size (usualy 512 or 1024). These two variables are permitted to be destroyed by subroutines at any time. I.E. use them when possible, but don't rely on the data staying once you call a function. We use these extensively for building queries. 2. For variables that need to be global, but are accessed only withing a single 4GL source code module, define them after Globals, but outside of a routine. This still uses space like globals, but keeps the global file smaller & reduces side affects with other modules. -- wilcoxon@pioneerplanet.infi.net ********************************************************************** ... this is only a test ... if this had been a real signature it would have been interesting **********************************************************************