× 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.



Bryce

See what you think of this. I don't like trusting a mechanism to clean up after me. I think it's preferable to deallocate memory myself, no matter what.

So this is an opportunity for using the monitor|endmon processing. You could wrap it around a front-end driver, for example, or pick suitable places to put it. But in any case, put a dealloc(e) in the on-error section, and maybe an eval to null of the pointer or pointers. This'd clean things up under you control always, and it'd not worry if the pointer is NULL. You can also test the pointer for NULL, I suppose.

Eh?
Vern

On 10/8/2010 7:21 AM, Bryce Martin wrote:
Scott and company,
Thank you all for verifying my understanding of how it works. I do plan
on doing the %dealloc myself, I was just wondering for the sake of testing
purposes before I have all my safe guards in place. I'm doing some proof
of concept stuff right now so I didn't really want to worry about trying
to catch every array index or decimal data error. If the program bombs
the AG will be destroyed, if it ends normally then the %dealloc will
happen. So I'm safe, me thinks :)


Thanks
Bryce Martin
Programmer/Analyst I
570-546-4777



"Schmidt, Mihael"<Mihael.Schmidt@xxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
10/08/2010 03:48 AM
Please respond to
RPG programming on the IBM i / System i<rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the IBM i / System i<rpg400-l@xxxxxxxxxxxx>
cc

Subject
RE: When does manually allocated memory get released?






End of ACTGRP or end of job will also free any allocated heap storage as
heap storage is an activation group-level resource.

Mihael

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of dieter.bender@xxxxxxxxxxxx
Sent: Friday, October 08, 2010 8:08 AM
To: RPG programming on the IBM i / System i
Subject: Re: When does manually allocated memory get released?

good practice would be to release the memory by your own, to avoid to
shrink
the heap space. End of ACTGRP will destroy all pointers in your static
allocated storage, but I would suspect, that there is no "garbage
collector"
to reclaim the heap storage.

D*B

--------------------------------------------------
From: "Bryce Martin"<BMartin@xxxxxxxxxxxx>
Sent: Thursday, October 07, 2010 10:02 PM
To: "RPG programming on the IBM i / System i"<rpg400-l@xxxxxxxxxxxx>
Subject: When does manually allocated memory get released?

List Experts...
I'm currently using a pointer based array and manually
allocating/reallocating space for the array. This program runs in a
named
activation group. If I don't manually deallocate (maybe due to an
uncaught error), does the memory get release when the AG is destroyed or
when the job ends? I'm guessing its when the AG is destroyed, but I'd
like to make sure.


Thanks
Bryce Martin
Programmer/Analyst I
570-546-4777
--- This message (including any attachments) is intended only for the
use
of the individual or entity to which it is addressed and may contain
information that is non-public, proprietary, privileged, confidential,
and
exempt from disclosure under applicable law. If you are not the intended
recipient, you are hereby notified that any use, dissemination,
distribution, or copying of this communication is strictly prohibited.
If
you have received this communication in error, please notify us and
destroy this message immediately. ---
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.