Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Is UDT data space reserved when UDT arrays are dimmed?

Author
Message
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 22nd Jan 2012 15:12 Edited at: 22nd Jan 2012 15:14
This is a question about the internal memory workings of AppGameKit with arrays, not a request for help using them.

When an array of a UDT type is Dim'd, does AppGameKit reserve space for the UDT data, or just nul pointers?

I need an array which uses a large UDT definition. The size of the array is initially unknown and since there are no array insert commands, it will have to be dimmed high at the start to allow for expansion.

Often a dim is followed by a pass through the new array, setting the UDT fields for each record to a default value. But if AppGameKit doesn't reserve UDT space on the DIM command, this pass is effectively forcing AppGameKit to reserve space which I ultimately might not need.

If it doesn't reserve the UDT space, I can dim much higher and simply wont initialise the data until needed. If it does, then I can carry on as before.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 22nd Jan 2012 17:03
I believe it reserves the memory on declaration, yes. But then again, I am sometimes way off the mark! lol

My signature is NOT a moderator plaything! Stop changing it!
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 22nd Jan 2012 18:48
That's also my understanding.

westalke
12
Years of Service
User Offline
Joined: 8th Dec 2011
Location:
Posted: 23rd Jan 2012 07:13
You can change the size of an array at any time by just doing another DIM on it. Existing values will be kept if you are expanding - or trimmed if you are shrinking.

Westa
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 23rd Jan 2012 08:42
Thanks for the info Westa! I thought they where emptied. That will come in handy.

Login to post a reply

Server time is: 2024-04-19 01:36:14
Your offset time is: 2024-04-19 01:36:14