Re: freeing a static after one use only?

From: Andreas Schwab (schwab@suse.de)
Date: Fri Feb 18 2000 - 11:01:30 EST


"Peter T. Breuer" <ptb@it.uc3m.es> writes:

|> I have experimented with using the gcc constructor extensions. The C
|> ones, that is, not the asm "do at startup" .ctors stuff.
|>
|> init_module() { ....
|>
|> foo = kmalloc(lots...);
|> __memcpy(foo,(FOO[]){ // use of constructor expression
|> ...
|> { 3, "holidays" },
|> ...
|> },
|> many);
|> ...
|> use(foo);
|> kfree(foo); // want to get rid of foo now!!!
|>
|> and to my surprise this doesn't oops. I thought this would allocate
|> 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.

The latter.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg

- 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/



This archive was generated by hypermail 2b29 : Wed Feb 23 2000 - 21:00:21 EST