As quickly as possible to free up memory all the variables in the structure?

Hi, there is a structure with a huge number of variables of type (char*), at the moment created a separate function that frees them one at a time. The essence of the question, what are the alternatives for a more convenient release of memory for a developer to cut the code?
March 23rd 20 at 18:42
2 answers
March 23rd 20 at 18:44
Language as so different that we need to do everything yourself.
It's in C++ is destructors.

Alternatively, if you are aware of you pre - allocate from one big structure.
Slice of your variables (here however the work will increase).
To release in one fell swoop.
March 23rd 20 at 18:46
Alternatively, if you know the size of all variables at once, select them all in the memory once. And release respectively the same. Or, if you know the maximum length of the array, then allocate again n*max_len for once.

Find more questions by tags C