×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
On 16/02/2008, at 3:30 PM, Mark S. Waterbury wrote:
Personally, I never, ever deallocate dynamically allocated storage.
Since the ILE heap is so large, we can usually afford to just keep on
issuing alloc for more and more storage. Eventually, at "end of job",
the whole ILE heap gets cleaned up automatically. So, this way, you
never have these problems with "dangling" pointers overlaying other
storage. (Also, those kinds of problems are usually very difficult to
debug.)
This approach also applies to all languages that can use dynamically
allocated ILE heap storage (even OPM MI assembler).
Might be fine for a program that always runs in its own job, starts,
does some work, and ends, but for anything that may run frequently in
an interactive job or a long-running batch server type job this is
just asking for trouble. Memory leaks abound in code with plenty of
storage available and eventually they cause problems.
I'm fairly sure you know that but there are others who might consider
this lazy way an acceptable one.
Pointers are like farm gates: if you open (allocate) it you should
close (deallocate) it. If it's already open leave it open. With
pointers however, there are some sloppy functions that return an
allocated pointer and expect the caller to deallocate so it's more of
a guideline than a rule but the point (hardeharhar) is obvious.
Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists
http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.