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



David,

You are right, but I was speaking about RPG GC. Steve keeps saying that RPG is a bad language (Not modern?) because it doesn't have a GC, but as RPG is defined it does, you the programmer.

On the other hand I am not saying that Java is a bad language because it has been defined in a way that needs/requires GC algorithms. With Java you would have to be so well informed that your only job would be garbage collection, you would have no actual time to create application code.

RPG already has several "GC" like capabilities, *INLR-(closing files etc...), activation groups, dealloc, ... A GC along the lines of the Java GCs could be implemented in RPG but to what end? What would be gained?

I'm trying to understand Steve's reasoning on why RPG is bad because it doesn't have GC.


Duane Christen

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of David Gibbs
Sent: Monday, June 23, 2008 9:43 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: the advantages of garbage collection


Christen, Duane J. wrote:
You are the best, and at times, the worst garbage collector known, a
programmer. Even the best garbage collection algorithm(s) can not
beat a well informed programmer.

Duane:

I think you're misunderstanding what a garbage collectors job is ... at
least as *I* know GC.

Generally speaking GC is used to free up memory occupied by data that
is no longer used. This is not a function a programmer can or should
be doing. In fact, I think it's generally a function outside of what an
application programmer can really do.

In Java, any objects that are actively in use will *NOT* be GC'ed. An
object has a reference when some other object still refers to it (or
contains it). You can remove that reference by setting all variables
that refer to the object to null or replacing the value of the variable
with another value.

For example ...

String s1 = new String("1"); // object "1" has a reference
String s2 = s1; // object "1" has two references
s1 = null; // object "1" now has one reference
s2 = null; // object "1" still exists, but no longer has
// any references to it and can can be GC'ed.

Also, in Java, even an explicit call to the garbage collector is just a
request to do garbage collection. Not a command to do so. Other
languages work differently of course.

If, however, you're taking about deallocating memory that was
programactially allocated by the application, then no GC routine in
existence can clean that up ... as only the application knows what is
still in use. The only time the system can know that the memory is no
longer in use is when the memory truly goes out of scope (in RPG terms,
I think that would be the activation group level). In this case it is
truly the programmers job to deallocate memory the application has
allocated when appropriate.

'course, I could be wrong. :)

david

--
IBM System i - For when you can't afford to be out of business

--
This is the RPG programming on the AS400 / iSeries (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.


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

NOTICE: This electronic mail transmission may contain confidential information and is intended only for the person(s) named. Any use, copying, or disclosure by any other person is strictly prohibited. If you have received this transmission in error, please notify the sender via e-mail.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.