Re: Forms memory leak....(?)

From: Kevin Mallory <kmallory_at_oracle.com>
Date: Tue, 29 Mar 1994 16:20:52 GMT
Message-ID: <KMALLORY.94Mar29082052_at_antfarm.oracle.com>


Folks,

        One thing that you *MUST* remember when you consider memory useage of any application written in "C" (which Oracle Forms (both 3.0 and 4.0) is how does the HEAP manager on the operating system work.

        If you allocate "N" bytes of memory (via malloc(),calloc() etc) N can be potentially large (as in the case of many nested call_form's), subsequent calls to free() of this memory do NOT free this memory back to the operating system. The "C" runtime library
"keeps" this memory around assuming that you are going to re-use it at
some time in the future.

        Further, the heap manager on most UNIX boxes is quite dumb (as compared to other nameless operating systems which have a few more intelligent memory allocaation schemes) The first malloc() you perform will allocate some fixed amount of memory (usually 128 pages) to your process. Subsequent malloc() calls cause the heap manager to give you chunks of memory that you have already allocated from that 128 pages. If your malloc() request will NOT fit into the heap you already have allocated, malloc() will generate another OS request for 128 additional pages, regardless of the size of your request. This can make your memory usage history look quite erratic!

        That said, I will reiterate a point I made several months back about the memory usage of CALL_FORM. There are several PL/SQL data structures which are created by virtue of the fact that you do a CALL_FORM. These data structures are NOT destroyed until you completely exit forms (3 or 4). These are internal context structures used by PL/SQL (and hence forms) to track variable/exception scoping. The assumption is made that you may again visit the same program units in the original scope (the memory is RE-USED if you re-enter the same form again) Currently there is not an interface available in Forms or PL/SQL which will allow you to destroy this memory during the processing of an EXIT_FORM request. Unless you really need to keep the "stack" of forms active (with transactions pending, e.g.) NEW_FORM is a better application design alternative.

--
Kevin Mallory, Oracle Corporation                 
Development Manager, Quality and Performance Programs, Oracle Forms Development


"QUALITY is never an accident; it is always the result of high
intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives."
Received on Tue Mar 29 1994 - 18:20:52 CEST

Original text of this message