Sign in

username:

password:



Not a member?

Search c6x



Search tips

Subscribe to c6x



c6x by Keywords

AD535 | BIOS | Booting | Bootloader | C621 | C6211 | C6415 | C671 | C6711 | C6711DSK | C6713 | CCS | Chassaing | COFF | DAT | DM64 | DM642 | DMA | DSK671 | DSK6711 | EDM | EDMA | EMIF | Emulator | EVM | EVM620 | FFT | FIR | GPIO | Halting | HPI | HWI | IDK | JTAG | LDB | LDH | LDW | Linker | LMS | LOG_printf | Matlab | McBSP | MEM_alloc | MIPS | PCI | PCM3003 | Pipeline | Profiling | QDM | Reset | ROM | RTDX | Sampling | SDRAM | Stack | TEB | THS1206 | TMS320C621 | TMS320C6416 | TMS320C6711 | TMS320C6713 | UART | Vector Table | XBUS | XDS560


Discussion Groups

Discussion Groups | TMS320C6x | Example on MEM_alloc OR MEM_calloc OR MEM_valloc

Technical discussions about the TI C6000 DSPs (including the c62x, c64x and c67x DSPs).

  

Post a new Thread

Example on MEM_alloc OR MEM_calloc OR MEM_valloc - norr...@yahoo.co.uk - May 17 19:13:50 2006



Hi guys,
Really appreciate this forum since the first time I join this forum :)

We always found in this forum about the issue of allocating memory dynamically. Can anyone give
some examples on using MEM_alloc or MEM_calloc or MEM_valloc. Below is one example that I took
from other discussion from this forum.

while(1)
{
p1 = (char*)MEM_alloc(heap1, 100, 8);
p2 = (char*)MEM_alloc(heap2, 100, 8);

MEM_free(heap1,p1,100);
MEM_free(heap2,p2,100);
}

Thanks, and I understand the syntax. But, can anyone give some example to assign value to this
'new' variable. I have tried like below :

while(1)
{
p1 = (char*)MEM_alloc(heap1, 100, 8);
p2 = (char*)MEM_alloc(heap2, 100, 8);

p1=23; //I want to assigned new value to p1

MEM_free(heap1,p1,100);
MEM_free(heap2,p2,100);
}

but got error:
 a value of type



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

Re: Example on MEM_alloc OR MEM_calloc OR MEM_valloc - eewizard_1 - May 18 0:51:10 2006

Hi norrizuan

Look at the info on MEM_calloc that you can find in the help function
of CCS.  It returns a pointer to where it's giving you the memory you
asked for.  It's not a value that you should change, it's where you
get to stuff your data.

Al
--- In c...@yahoogroups.com, norrizuan@... wrote:
>
> Hi guys,
> Really appreciate this forum since the first time I join this forum :)
> 
> We always found in this forum about the issue of allocating memory
dynamically. Can anyone give some examples on using MEM_alloc or
MEM_calloc or MEM_valloc. Below is one example that I took from other
discussion from this forum.
> 
> while(1)
> {
> p1 = (char*)MEM_alloc(heap1, 100, 8);
> p2 = (char*)MEM_alloc(heap2, 100, 8);
> 
> MEM_free(heap1,p1,100);
> MEM_free(heap2,p2,100);
> }
> 
> Thanks, and I understand the syntax. But, can anyone give some
example to assign value to this 'new' variable. I have tried like below :
> 
> while(1)
> {
> p1 = (char*)MEM_alloc(heap1, 100, 8);
> p2 = (char*)MEM_alloc(heap2, 100, 8);
> 
> p1=23; //I want to assigned new value to p1
> 
> MEM_free(heap1,p1,100);
> MEM_free(heap2,p2,100);
> }
> 
> but got error:
>  a value of type
>



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