1 registered members (AndrewAMD),
692
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Optmizations
#411834
11/20/12 11:13
11/20/12 11:13
|
Joined: Nov 2011
Posts: 139 India
Yashas
OP
Member
|
OP
Member
Joined: Nov 2011
Posts: 139
India
|
Will sys_free work for big char pointer arrays?? Ex:char * collection[1024];
I want to get it out from the memory. And what all are the ways to optimize scripts: 1. Fix Memory Leaks 2. Using pointers wherever possible instead of arrays
Thanks
Last edited by Yashas; 11/20/12 12:51.
|
|
|
Re: Suddenly I jump to efficency of coding
[Re: Yashas]
#411843
11/20/12 12:18
11/20/12 12:18
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
Will sys_free work for big char pointer arrays?? Ex:char * collection[1024]; No, because its statically allocated. Only use sys_free where you have used sys_malloc. Thats not optimization, its bug fixing, cause sooner or later memory leaks will disgracefully end your application. Using pointers wherever possible instead of arrays Arrays are pointers to memory areas. So what is this supposed to do?
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Suddenly I jump to efficency of coding
[Re: Yashas]
#411851
11/20/12 12:47
11/20/12 12:47
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
Since acknex.exe is an interpreter(or sort of it) It's not, Lite-C is a compiled language. If you use a static array, the memory of it will be allocated by the system when it loads your binary (or if it's on the heap, it will be just an sub instruction), if you use malloc() or sys_malloc(), the memory will be allocated at the runtime of your program.
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
|