Re: Static memory Help
Posted in 1995
Thank you for reply but my question was about using memory. I mean that my problem is that I have an application using 8 arrays of 9999 elements declared in the module and not globals. One of my customers (with more then 50 connections on the database) sometimes receive a 1257 error (operatting system cannot fork process for back end) and I've seen that there is no more memory available. For this reason I thought to reduce the number of arrays moving this from functions declaration to globals (Yes they are identical). This suggested me that Informix allocate the memory of application staticly and not dynamicly. When he start the application the runner allocate the memory for all variables declared (the globals, the modules and the functions variables) and not only for the globals, allocating then modules and functions variables when you call the module. The question was : Is that true or I'm missing something. Thanks . P.S. Sorry for my not good english. }* I've a little question for informix gurus. }* }* I would like to know how informix handle the memory for variables. }* The proble that I have is that I need to use in one of my modules some array }* of 9999 elements. I declared this arrays after the declaration of globals }* variable: }* }* ... }* ... }* Globals "glob.4gl" }* define a_arr array[9999] of record }* ... }* end record }* }* function Some_name }* ... }* }* The question is : }* }* A declaration like this would allocate the needing memory as same as if the }* array was in the globals or it will allocate it only in case of running this }* function . }* }* And what will happen if the declaration was after the function statement ? }* }* Someone told me that informix will allocate the memory in a static way for }* all the vcariables in the .4gi program. Is this true ? } }There is three ways variable are allocated in 4GL. First, locally. That is, }the variables are local to a specific function. } } Ex. } } # My Module } FUNCTION my_func() } DEFINE } local_var CHAR(20) } END FUNCTION } }Next, there is global variables. That is, variables defined within the GLOBALS }section. } } Ex. } } # Globals Module } GLOBALS } DEFINE } global_var CHAR(20) } END GLOBALS } }Lastly, there is static variables. These are the same as global variables, }they use the same area as global variables and only get initialized once, }yet, they are accessible only to the module they reside in. } } Ex. } } # My Module } DEFINE } static_var CHAR(20) } FUNCTION my_func() } END FUNCTION } }Hope this helps, } } Robert Minter Data Systems Support \\\\\\_/// }Senior Software Engineer A Client Technologies Company ( _ _ ) }E-Mail: rob@dssmktg.com Tel: 714.771.0454 (| ^ |) }#include <disclaimer.h> Fax: 714.771.3028 \\`-'/ }De Colores - Emmaus OC-13 SURF'S UP \\_/ } Pierluigi "PIGI" Frullani Frumar srl pigi@frumar.it