How many objects (IDs) can be generated by script?
Richard Gaskin
ambassador at fourthworld.com
Fri Jun 26 17:21:05 EDT 2020
Heriberto Torrado wrote:
> I read this thread, but it's old and it is not very clear to me.
>
> http://forums.livecode.com/viewtopic.php?t=22112
>
> I have the same problem than "Havanna".
>
> About six years ago I developed a Livecode desktop app for my company.
> Several employees open and close the app several times a day.
> Many fields are created at runtime.
>
> The current IDs are in the 250.000
>
> Is there a limit?
> Can we have a problem on the next years?
> Did it changed with Livecode 64bits versions?
My understanding is that the 64-bit versions of LC are compatible with
64-bit OSes, but internal addressing is still 32-bit.
So AFAIK my comment from the thread you linked to still applies:
IDs are 32-bit unsigned integers, so the range of possible values
goes up to about 4 billion.
If you never manually set IDs, since the engine begins with ID 101
and increments within a stack from there with each object created,
for all practical purposes over the life cycle of an app there's
little risk of running out of IDs.
If you're curious about what happens when you exceed the range of
possible values, you can set a control's ID to the highest value
allowed (UINT4, or 4294967295), and then create some new controls.
Last time I did that (several versions ago) I found nothing amiss
during the current session, but after saving the stack I was unable
to open it again.
As long as you work with ID ranges well below the maximum, you should
have no problem for many years even with the DataGrid or other
controls that create large numbers of objects dynamically. Given
practical memory limits, ID range could only be a problem if you go
out of your way to set IDs to unnecessarily large numbers.
If by chance you happen to have the first project in this community's
history that actually runs out of IDs, the worse thing that would be
needed would be to simply copy the controls to a new stack (could
easily be automated), in which the ID numbers would be reset starting
at 101.
--
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