Sign in

username:

password:



Not a member?

Search c55x



Search tips

Subscribe to c55x



c55x by Keywords

AIC23 | C5509 | CCS | CSL | EMIF | EVM | GEL | GPIO | HPI | Interfacing | JTAG | McBSP | OMAP | Omap15 | OMAP59 | RTDX | SDRAM | TMS320VC5509 | USB | XDS5

Discussion Groups

Discussion Groups | TMS320C55x | Re: dynamic vs. static

Technical discussions about the TI C55x DSPs (including the c5501, c5502, c5503, c5507, c5509, c5510 and OMAP5910).

  

Post a new Thread

dynamic vs. static - Ranjeeta - May 7 10:05:50 2007



Hi All,

This may not be the right group to ask this question. But is related to DSP
processors only.

I am working ion H.264 code. The code includes lots of nested structures, 6
dimentional pointers... and dynamica memory allocation.

Before calling malloc and calloc the size of the variable is calculated at
run time (which may vary for different modes) and that much memory is
allocated. the code is quite complicated from dynamic memory allocation
point of view.

Now one of my senior wants me to convert dynamic memory allocation to static
arrays, some scratch buffers can be used which are being used in one part of
code at one time and other part of code at some other time. According to him
this is imporartnt for DSP implemntation point of view. Now my question is
why is it important. Is statuc memory allocation going to be useful here
instead of dynamic memory allocation???? Since it seems to be very difficult
to find the optimum array size required for any dynamic memory part, i m not
able to start up.

Please help me.. as I am not able to start.

Thanks
Ranjeeta



(You need to be a member of c55x -- send a blank email to c55x-subscribe@yahoogroups.com )

Re: dynamic vs. static - Jeff Brower - May 7 10:29:59 2007

Ranjeeta-

> This may not be the right group to ask this question. But is related to DSP
> processors only.
>
> I am working ion H.264 code. The code includes lots of nested structures, 6
> dimentional pointers... and dynamica memory allocation.
>
> Before calling malloc and calloc the size of the variable is calculated at
> run time (which may vary for different modes) and that much memory is
> allocated. the code is quite complicated from dynamic memory allocation
> point of view.
>
> Now one of my senior wants me to convert dynamic memory allocation to static
> arrays, some scratch buffers can be used which are being used in one part of
> code at one time and other part of code at some other time. According to him
> this is imporartnt for DSP implemntation point of view. Now my question is
> why is it important. Is statuc memory allocation going to be useful here
> instead of dynamic memory allocation???? Since it seems to be very difficult
> to find the optimum array size required for any dynamic memory part, i m not
> able to start up.

The reasons I can think off the top of my head to use static memory vs. dynamic:

1) Memory object size doesn't change and objects can be efficiently declared as arrays or
structures and precisely
located in internal and external memory, possibly making code easier to debug (you already
touched on the variable
size aspect).

2) Specific, fixed memory addresses are required.  For example due to memory alignment
requirements for a circular
buffer (e.g. FFT), due to external processor interface (via HPI),

3) Allocation and de-allocation of memory at run-time takes too long (rare).

4) Extra memory management library code takes too much mem space (rare).

Otherwise, I'm not sure why your colleague is requiring this.  Certainly the resulting code
will be less portable
between DSPs.  If the mem areas are really large, maybe there is an issue of where the memory
manager will allocate
space (int vs. ext  mem)... you should ask your colleague to provide a technical basis for the
requirement.

-Jeff



(You need to be a member of c55x -- send a blank email to c55x-subscribe@yahoogroups.com )