Allocation of array memory
#1

I don't know quite how this works so I'll you ask you guys if you could explain it to me. For example, if we make a function that creates an array with size of MAX_PLAYERS macro and that function is called from some callback (let's say OnPlayerSpawn). My question is, when does the server take it's required memory for that array from the server machine which the server itself is hosted on? Does it allocate it when the function is called and deallocated when the function is completed?

And one more question. Let's say that two players join the server at the same time. Does, for example, OnPlayerConnect callback get called at the same time for both players or one after another?
Reply
#2

1. The Array you've made is a global variable. So it gets to the heap space and the Memory get allocated by compiling..your .amx doesn't resize...so its in this.

2. It's get called one by one...because you only have 1 Thread (except NPCs there are running in another thread).

Greekz
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)