static or new
#1

Hi which of static/new use less stack/heap memory in a function?
Reply
#2

They both require the same space. The only difference is that static acts like a global variable and retains its value between function calls whereas new reinitializes the variable every time.
Reply
#3

Ok thanks a lot i will use new in my case.
Reply
#4

----
Reply
#5

Keeping the stack small isnt a bad idea, but as said, isnt as essential as it was 15 years ago.
In theory statics are faster when used repetitive, as they dont need to be pushed again and again. Dont know how well pawn does that though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)