KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Which is preferable way to allocate memory for a function that is frequently allocating and freeing memory ? Assume this function is getting called around 500 to 1000 times a second on a 1GHz Processor. (Please ignore static and global variables/allocation. I am interested only this specific case:) void Test() { ptr=malloc(512) // 512 bytes ... free(ptr) } OR void Test() { struct MyStruct localvar; // 512 byte sized structure ... }
Tags (comma-separated)
Save Edits
Cancel