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



>From experience... create a user space in QTEMP and get a pointer to the
user space data. Make sure auto-extend is enabled and treat is just like
regular memory that doesn't require a reallocate operation.
Depending on various circumstances, this technique can be faster from start
to finish than excessive alloc/realloc operations, but your mileage may
vary.
The other benefit is, as you pointed out, you don't have to remember to do
the DeAlloc and the end of the program, when the job ends, the usrspc in
qtemp goes away. Of course do would memory allocated with alloc/realloc but
that's just poor programming to not free memory that you've allocated.

-Bob Cozzi
www.RPGxTools.com
If everything is under control, you are going too slow.
- Mario Andretti


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Larry Ducie
Sent: Thursday, March 17, 2005 10:43 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: data pointer vs userspace

Hi,

I'm writing some code to generate xml data, and it is stored, provisionally,

on a pointer.

My question is: Which is the best place to hold the data - a pointer within 
a userspace or a data pointer within the program?

I will need to be able to generate data of varying sizes, from 100 bytes to 
100k. However, each instance of the app will generate data of a consistent 
size: Instance 1 will generate 100 byte xml (inventory transactions), 
instance 2 will generate 32-64k xml (picktickets), etc...

I know I can allocate up to 16mb of memory to a data pointer, and similar 
sizes on a userspace. BUT what scenarios favour one over the other? Which is

fastest to allocate? Which is fastest to reallocate? Which is the most 
flexible? Which is the most stable/reliable/resilient?

I know I can auto-extend a userspace, is this better than %realloc on a data

pointer? I also know I can %realloc less memory to a data pointer, can you 
auto-decrease a userspace? Is it actually worthwhile reallocating less 
memory to a pointer, or should I only change it upwards?

Finally, I would not expect the memory I allocate to persist once the job 
has finished.

Again, your wise words are most welcome.

TIA

Larry Ducie


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

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.