Should size be extended to variables?
Richard Gaskin
ambassador at fourthworld.com
Sat Aug 20 15:05:20 EDT 2016
Mark Waddingham wrote:
> On 20 Aug 2016, at 18:01, Mark Talluto wrote:
>>
>> On Saturday, August 20, 2016, Richard Gaskin wrote:
>>> Any other options I should consider before submitting a request for
>>> some means of determining data length in bytes?
>>
>> Yes. Arrays.
>
> For what purpose?
>
> The key thing here is that the number of bytes a value currently
> takes up in memory is not actually a good measure for how much memory
> is being used because instances of values can be shared.
>
> To put it another way, the memory footprint used by two arrays will
> not necessarily be the same as the sum of the memory footprint of the
> two arrays measured separately as they might share the actual memory
> used by any value in either array. e.g the values used to store the
> keys in an array are *always* shared.
Would that apply across sub-arrays? e.g., given:
someKey=
Name=Mark
EmpID=2
anotherKey=
Name=Kevin
EmpID=1
...would "Name" and "EmpID" use the same string in memory?
As for byte sizes, my own use case is for establishing pointers to
locations within a large file on disk.
But as Richmond kindly reminded me, the byte chunk type supports that
with "the number of bytes of...", so I'm set for now.
> For optimization purposes the best approach is to measure the amount
> of memory *actually* in use before and after any particular operation
> you perform - just as you do with time when profiling for speed
> (rather than memory footprint).
Is there some built-in way to get the amount of memory in use, or are
you thinking of shell calls there?
--
Richard Gaskin
Fourth World Systems
Software Design and Development for the Desktop, Mobile, and the Web
____________________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list