Timeline for answer to how free() works? by David Heffernan
Current License: CC BY-SA 3.0
Post Revisions
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 10, 2011 at 8:08 | comment | added | David Heffernan | Sorry I don't understand the question | |
| Aug 10, 2011 at 7:55 | vote | accept | Jeegar Patel | ||
| Aug 10, 2011 at 7:56 | |||||
| Aug 10, 2011 at 7:55 | comment | added | Jeegar Patel | @David Heffernan i got it all....thnk u... one more thing in any case m i able to access those memory which i have freed.? | |
| Aug 10, 2011 at 7:33 | history | edited | David Heffernan | CC BY-SA 3.0 |
added 61 characters in body
|
| Aug 10, 2011 at 7:27 | history | edited | David Heffernan | CC BY-SA 3.0 |
added 499 characters in body
|
| Aug 10, 2011 at 7:26 | comment | added | Chris Lutz |
Some people advocate using #define free(x) do { free(x); x = NULL; } while(0) to avoid forgetting to set the pointer to NULL when you're done with it. In my experience the pointer frequently falls out of scope right after I free it, so I don't usually bother.
|
|
| Aug 10, 2011 at 7:25 | comment | added | Dhaivat Pandya | Both the stack and heap on the RAM. Malloc should reserve on heap space, so it isn't deleted at the end of the function. | |
| Aug 10, 2011 at 7:23 | comment | added | David Heffernan |
@Mr. 32 That's implementation specific but in most systems malloc allocates heap memory.
|
|
| Aug 10, 2011 at 7:20 | comment | added | Jeegar Patel | when we malloc something..where actuly this memory gona reseve.?? in stack ..? in heap..? in Ram..?? | |
| Aug 10, 2011 at 7:18 | history | answered | David Heffernan | CC BY-SA 3.0 |