malloc, and other simular functions
Posted: Tue Dec 25, 2007 9:21 am
Hi,
I dont have much expirience whit coding in c, but i am trying to build a simple neural network, so a program which require's a lot of memory and which needs to get "free" mem fast.
Now i know malloc is used allot, but how does it work and is it fast? so if for instance i where to call :
malloc(44);
Would malloc then only use up 44 byte's of memory or would it actually use up more then the 44 byte's i asked for?
Also how fast is malloc? or are there other better functions which i could use?
Also is malloc better at finding small ammounts of free memory or better at large ammounts of memory? (small being 32 - 1024 bytes, large 1024++ bytes)
So the general question is: What options do i have when i need free mem in C and what are the good points VS the bad points to these method's.
Regards PyroMathic
BTW: i do know how to build a mem-alloc function in for instance assembly, i just think that, that would be a waste of time...
I dont have much expirience whit coding in c, but i am trying to build a simple neural network, so a program which require's a lot of memory and which needs to get "free" mem fast.
Now i know malloc is used allot, but how does it work and is it fast? so if for instance i where to call :
malloc(44);
Would malloc then only use up 44 byte's of memory or would it actually use up more then the 44 byte's i asked for?
Also how fast is malloc? or are there other better functions which i could use?
Also is malloc better at finding small ammounts of free memory or better at large ammounts of memory? (small being 32 - 1024 bytes, large 1024++ bytes)
So the general question is: What options do i have when i need free mem in C and what are the good points VS the bad points to these method's.
Regards PyroMathic
BTW: i do know how to build a mem-alloc function in for instance assembly, i just think that, that would be a waste of time...