freeing a static after one use only?

From: Peter T. Breuer (ptb@it.uc3m.es)
Date: Thu Feb 17 2000 - 17:54:46 EST


I have another request for help ... I humbly beseech such advice
as may be bestown.

I have a large static initialized array that that is compiled into a
module (it's a translation table, int to char*). I want to

  use it once and then throw it away
  
after it has been used for the purpose it was defined for: translating
kernel data into another format. The latter will be supplied by the
module to readers on demand.

So ... is there a magic gcc incantation to do this? It's about 20KB
of static data. I.e.

     static const FOO array[] = {
       ...
       { 23, "holiday_time" },
       ...
     };

     init_module() {
        ...
        use_the_thing_to_make_a_new_thing(array,new_array);
        throw_away_the_thing(array);
        ...
     }

It's much larger than the thing it's used to create, so there is no
advantage in overwriting it with the result.

(I imagine that some of the lowlevel sound card drivers do this, when
they want to load firmware).

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/



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