Hi Marco,
You don't say if you are running UV or UD, but here is my guess for UV.
>I would like to understand the impact on memory fragmentation of
repetitively DIMing an array or even doing a >plain string assignment (with
no change in size) e.g:
Assuming you are running in an account flavour which allows you to reDIM an
array, I don't think the DIM per se will have any affect unless you changes
the size or number of dimensions of the array (since array contents are
preserved, which I presume is done in place).
Even then, I don't think you will have much control over memory
fragmentation as UV will allocate storage to each array element only when
you assign something to it (I would expect even MAT ARRAY = "" to use a
separate memory allocation request for each element, since each is a
separate UniVerse variable unlike array allocation in C, where you allocate
the entire array and then index into it at element length offsets).
Practical experience with reassigning strings suggests that the same memory
is used for each assignment unless more memory is required, so I wouldn't
expect more memory to be allocated for no matter how many times you repeat
it:
D.LINE = STR("=",132)
I sometimes use this fact when processing large amounts of data into a known
length output by preallocating the output variable and then placing my
output into it:
eg:
BUFFERLEN = 2048
OUTDATA = STR(BYTE(0), BUFFERLEN)
POS = 1
...
SOMEDATALEN = BYTELEN(SOMEDATA)
OUTDATA[POS, SOMEDATALEN] = SOMEDATA
POS += SOMEDATALEN
...
IF POS LT BUFFERLEN THEN
OUTPUT[POS, -1] = ""
END
So my conclusion is probably little or none, you should be more worried
about allocating strings little bits at a time.
But I have been horribly, embarrasingly wrong about things before this (just
this morning in fact) :)
HTH,
Craig
--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users