Messages in this thread | | | From | "Peter T. Breuer" <> | Subject | Re: freeing a static after one use only? | Date | Fri, 18 Feb 2000 14:19:58 +0100 (MET) |
| |
"A month of sundays ago Alan Cox wrote:" > > the temporary structure from the stack? Either it is so, and I am about > > to crash (the array is about 10K), or gcc has made a kmalloc/kfree > > call ... or it has allocated the temporary data as a static constant. > > gcc made it static content
Interesting. Fine control of memory allocation strategies is harder to achieve in C than it seems! In the example, I declared no statics, and I thought that therefore the allocation of the temporary constructor expression would come from the stack (causing me to cringe and wait for the crash ..).
I'll repeat the code section, just to make it clear ...
init_module() { FOO *foo; .... foo = kmalloc(lots...); __memcpy(foo,(FOO[]){ // use of constructor expression ... { 3, "holidays" }, ... }, many);
So, no win, no lose. I might have tried next
foo[0] = ..; foo[1] = ..; ....
But that will expand the code section by a few hundred instructions! Nevertheless, I'll try it.
Peter
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |