Thomas Ward wrote:
> Hi All,
>
> I have an application, with the following declarations:
>
> typedef struct {
> ... // a couple fields
> } my_structure;
>
> my_structure my_array[100]; // global variable
>
> This worked fine, but I realized that I only need this array for a specific
> function. So, to minimize global memory used, I changed it to:
>
> my_structure *my_array; // global variable
>
> which I then allocate and free. This works fine, as well. The thing that has
> me perplexed is that the size of my .PRC file is exactly the same either
> way! I THOUGHT the size of my .PRC would shrink by approximately
> 100*sizeof(my_structure), but it didn't shrink at all! So, two questions:
>
> 1. Why is my .PRC file the same size either way?
Because the you are conserving data memory with this technique and not code
memory. The PRC file is the amount of code NOT the amount of data used during
execution. The data space is only there are run time.
>
> 2. Am I wasting my time? Or is this type of memory saving worth doing?
It is very much worth doing. I do this all the time when global data is being
used, for example, in a modal dialog only when the modal dialog is up and being
used.
>
>
> Thanks in advance,
>
> Tom Ward