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



Hi Simon,

> Given that you said "I'm building a service program (in RPG) with the
> intent of simplying the use of dynamic heap storage."
>
> I honestly can't see anything simpler than the supplied RPG IV op-codes:
>
> ALLOC
> REALLOC
> DEALLOC

You're right, it doesn't get any simpler than that. I just did a poor job of
explaining what I'm trying to achieve. The xxALLOC opcodes are very easy to
use but, as with much of RPG, their implementation is a bit quirky. For
example:

- ALLOC doesn't provide an option to initialize the storage during
allocation. This makes for some interesting bugs if the programmer reads
back more data than he wrote to the heap.

- DEALLOC forces you to remember to add the  (N) opcode extender in order to
automatically set the pointer to NULL. At the very least, shouldn't this
have been the default? After all, why would you let a programmer maintain a
valid pointer to heap storage that you've just freed? Maybe there's a good
reason for it, but I've yet to run across it.

- Error reporting is very primitive. Status 426 - error in storage
management operation, is not exactly informative.

Those are some of the basic "clean-up" improvements, but the main purpose of
the service program is to extend the existing functionality. Like providing
functions that allow you to increase/decrease the allocated size at a given
offset, instead of simply extending/truncating storage from the end.


> You also said:
>
> >This is only good for the default (ILE) heap.
>

Yes, as part of my explanation of RPG's intrinsic support. The xxALLOC
opcodes are limited to the default heap.

> IBM provide a set of ILE storage management APIs that let you define you
> own heap and control the allocation strategy.
>

Yes, those are the ones I'm using in the service program. In fact, I'm
pretty certain that they're the ones used by the RPG compiler as well.

Thanks for the feedback.


John Taylor






As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.