Gamestudio Links
Zorro Links
Newest Posts
NOMAX undeclared identifier.
by Petra. 01/09/26 21:12
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 01/07/26 15:14
Zorro locks DLL
by jcl. 01/07/26 13:33
zorro with ccxt?
by qin. 01/07/26 07:50
The new evaluation system
by jcl. 01/05/26 08:50
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (Quad, LucasJoshua, AndrewAMD), 5,616 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Namitha_NN, Syndrela, agasior, mosfet, MonsterX
19188 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Local variable array limit in ent_create function. #164989
11/01/07 22:29
11/01/07 22:29
Joined: Oct 2003
Posts: 130
Wollongong Australia
J
Jethro Offline OP
Member
Jethro  Offline OP
Member
J

Joined: Oct 2003
Posts: 130
Wollongong Australia
Lite-c latest version 7.06.1 demo.
Also free Lite-c.
When an ent_create's function has a huge array defined in it locally, the engine crashes.
eg.
function Big_data_ent(){
var my_data[100000]; //This will work if 10000.
var i;
for (i=0; i<100000; i++) // reset the array first before loading up.
my_data[ i ]=0; // Tried #define PRAGMA_ZERO didn't help
}

function Load_Group(){

ent_create (orbox_mdl, my.x, Big_data_ent);

}
I've been using Gamestudio since A3.9 so I'm pretty sure I've exhausted all possibilities and this is a bug.
The manual states local vars have an array size limit of 3 in c-script but there is no such limit in lite-c. OK.
What about ent_created functions local var arrays, as these must be dynamically allocated, depending on when and how many entities are created.

Regards .. Jethro.

Re: Local variable array limit in ent_create funct [Re: Jethro] #164990
11/02/07 09:59
11/02/07 09:59
Joined: Jul 2000
Posts: 28,050
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,050
Frankfurt
This is likely a stack overrun. You can not put data structures this size on the stack.

If you need arrays of this size, you must allocate them from the heap, using malloc(). As a rule of thumb, when your fingers and toes won't suffice anymore to count your local variables, you need malloc().

Re: Local variable array limit in ent_create function. [Re: Jethro] #164991
11/05/07 00:42
11/05/07 00:42
Joined: Oct 2003
Posts: 130
Wollongong Australia
J
Jethro Offline OP
Member
Jethro  Offline OP
Member
J

Joined: Oct 2003
Posts: 130
Wollongong Australia
Thanks Jcl, maybe the manual should be modified to clear this up.

Regards ... Jethro.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1