a pointer just indicates where in memory something resides. it doesn't
know or care about the length of data, etc is. that's something that you
have to handle yourself. if the data PGM A placed at that starting
address is 10 bytes long and PGM B overwrites from that pointer address
for 20 bytes you'll corrupt data (memory overflow).
Thanks,
Tommy Holden
From:
Jerry Adams <Jerry@xxxxxxxxxxxxxxx>
To:
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
Date:
06/19/2008 04:13 PM
Subject:
RE: Memory Leaks in RPG (was: Is RPG 'DEAD")
Like David, I'm learning a lot from these emails (just a lot more slowly).
A pointer is, as stated, just an address. But it's just the starting
address, right? Which, if I understand Bruce's example and David's
concern correctly, means that PgmA could pass PgmB an address to a parm.
But this pointer/address wouldn't have any clue how long that parm is,
right? I.e., if PgmA intended for PgmB to use, say, ten bytes it would
have to pass that bit of trivia with the pointer. But, if PgmB decided to
use twenty bytes starting at the passed address, it could. Or is the
length of the address space to be used inherent in the pointer itself?
Jerry C. Adams
IBM System i Programmer/Analyst
B&W Wholesale
office: 615-995-7024
email: jerry@xxxxxxxxxxxxxxx
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of David Gibbs
Sent: Thursday, June 19, 2008 3:09 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Memory Leaks in RPG (was: Is RPG 'DEAD")
Bruce Vining wrote:
When you manipulate a SLS pointer (add/subtract/etc) there are checks
within the system to ensure that the new pointer value still
addresses a location within the object initially addressed by the
pointer. You cannot simply assign a pointer value arbitrarily and
you cannot arbitrarily access storage of another job (unless of
course that job gave you a pointer to the job).
Ok, that's what I figured. Just wanted to make sure.
Yes, program B in job B can write to the storage of job A if job A
gives job B addressibility (a pointer to its storage).
Interesting ... scary powerful though.
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.
As an Amazon Associate we earn from qualifying purchases.