Hassan (08-31-2011)
Other way round bud, static remains at a constant memory allocation. Creating a new character array (as in my earlier post) every iteration does allocate new memory every iteration (while it does clean up the old memory due to it going out of scope, it's still overhead you don't need.)
Nice try with the insult code, shame you forgot to add 1 to "Doesnt" meaning his array with be { "0", "1"...."29999" }
QQ moar.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
Hassan (08-31-2011)
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
Yes, that is exactly why I am mad. Because MJ is awesome. I am not being sarcastic, I really and truly believe it...
-.-
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
Yes, you are correct that my second solution would not work as I thought, at the time I just assumed itoa malloc'd some memory and returned that as it's returned char*, I use C not C++ mostly so I don't have itoa often, and have to write my own.
So, my original solution (the first one i posted) works anyway, get off your high horse.Code:static char* __itoa(int v) { char *retVal = (char*)malloc(sizeof(char) * 10); sprintf(retVal, "%d\0", v); return retVal; } static int main(int argc, char *argv[]) { char *values[30000]; for ( int i = 0; i < 30000; i++ ) values[i] = __itoa(i + 1); //assigning is complete, just to verify that all is correct we'll print them. for ( int i = 0; i < 1000; i++ ) printf("%s\n", values[i]); //free the malloc'd memory for ( int i = 0; i < 30000; i++ ) free(values[i]); return 0; }
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
LOL itoa doesn't exist in C bud, so of course I wrote my own, I specifically stated that I made a mistake with my previous post, I was just used to my own itoa because I use C most of the time not C++.
Also, posting:
Is what? Constructive?Code:char* OP[30000]; for (int Doesnt = 0; Doesnt < 30000; ++Doesnt) { char* KnowCPP = new char[15]; _itoa(Doesnt, KnowCPP, 10); OP[Doesnt] = KnowCPP; }
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
Hassan (09-01-2011)
/Sigh. Jason's correction works. i.e;
[highlight=vb]char *largeArray[30000];
for(int i = 0; i < 30000; i++)
largeArray[i] = itoa(i + 1, new char[10], 10);[/highlight]
The OP doesn't gives a flying fuck if he wrote anything afterwards, so no big deal.
/Closed.