|
Thanks for the clarification. I think I'll stick to the bifs and then use H-specs keyword if needed as I don't need teraspace at the moment but would like to have it for the worst case scenario. (after giving it some more thought it probably won't do it any harm if I change it to teraspace now)
It seems that an exchangeable memory management module wouldn't be that bad.
Thanx
Mihael
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Monday, March 14, 2011 9:31 AM
To: Midrange Systems Technical Discussion
Subject: Re: Teraspace Storage Model and CEE APIs
Hi Mihael,
I don't think the ILE CEE APIs support teraspace at all. If you want to
allocate memory in teraspace, why not call the teraspace APIs? (This
has been available in RPG since v4r4...)
Here are the prototypes:
/if defined(*V5R2M0)
D TS_malloc64 PR * ExtProc('_C_TS_malloc64')
D size 20U 0 value
/endif
D TS_malloc PR * ExtProc('_C_TS_malloc')
D size 10U 0 value
D TS_realloc PR * ExtProc('_C_TS_realloc')
D ptr * value
D size 10U 0 value
D TS_free PR ExtProc('_C_TS_free')
D ptr * value
With these, RPG can allocate terabytes of memory to a single pointer.
You don't need the teraspace storage model to use these...
In 7.1, IBM added the teraspace storage model to RPG. The storage model
controls the memory used for automatic, static, and constant storage --
in other words, it has no impact on the stuff you allocate yourself from
the heap!
IBM also added the ALLOC H-spec keyword in 7.1 that lets you control
whether the ALLOC/REALLOC opcodes and %ALLOC/%REALLOC BIFs use teraspace
or single-level storage. However this has no impact on what happens
when you call an API to allocate memory, it only affects the opcodes/bifs.
So if you want to use teraspace for heap storage, and you don't want to
wait for 7.1, just call the teraspace routines. Maybe even wrap them
with a subprocedure, so you can switch your code between the various
alternatives (CEE APIs, RPG opcodes, teraspace APIs, etc) without having
to change the logic of your main program.
On 3/14/2011 2:17 AM, Schmidt, Mihael wrote:
I got a program which uses dynamic storage (CEE APIs) to store some
temporary data in memory. So far so good as everything is working
fine and there is no current business case which makes my program
exceeds the memory it can allocate. I am using the default heap.
Now as I understand it IBM i 7.1 lets you compile RPG modules with
teraspace as the storage model. Does that also mean that the CEE API
uses memory from teraspace and does it mean that I can use 1TB with
the same api and just a different compile setting (
STGMDL(*TERASPACE) ) ? I have no chance to test this as we are on 6.1
still.
As an Amazon Associate we earn from qualifying purchases.
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.