Technical discussions about the TI C6000 DSPs (including the c62x, c64x and c67x DSPs).
Post a new Thread
memory allocastions in DSP/BIOS - alon...@rafael.co.il - Nov 15 9:05:00 2005
Hi all,
Using the DSP/BIOS operatinf system, I have hard times with the memory allocations.
I want to use 'MEM_alloc' / 'MEM_free' instead of using 'new' and 'delete' (I work on C++).
The reson is : using MEM_alloc I can define the memory section to be allocated in.
The problem is that in order to use MEM_Free, I need to know the size to free, and this is too
much..
Is there any simple solution to use MEM_alloc and MEM_free without telling the DSP/BIOS the
size I want to free?
Thanks,
Alon.

(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )
Re: memory allocastions in DSP/BIOS - Ganesh Vijayan - Nov 15 9:29:00 2005
Hi,
In case you allocate memory using MEM_alloc,
you can free it by "free" itself. You needn't use MEM_free. Alternatively, if you are using
XDAIS framework, even size information is stored in the memTabs which you can use.
Hope this helps.
Ganesh
----- Original Message -----
From: a...@rafael.co.il
To: c...@yahoogroups.com
Sent: Tuesday, November 15, 2005 6:35 PM
Subject: [c6x] memory allocastions in DSP/BIOS
Hi all,
Using the DSP/BIOS operatinf system, I have hard times with
the memory allocations.
I want to use 'MEM_alloc' / 'MEM_free' instead of using 'new' and
'delete' (I work on C++).
The reson is : using MEM_alloc I can define the memory section
to be allocated in.
The problem is that in order to use MEM_Free, I need to know the size
to free, and this is too much..
Is there any simple solution to use MEM_alloc and MEM_free
without telling the DSP/BIOS the size I want to free?
Thanks,
Alon.

(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )
Re: memory allocastions in DSP/BIOS - Roger Kingsley - Nov 16 3:14:00 2005
Actually, most allocations of malloc store the block size at the start
of the block, and then pass the pointer after this "management overhead"
- and so free knows how to get the block size. Which is why free often
crashes if someone has overwritten memory.
If you are not using XDAIS, you could do something similar by wrapping
MEM_alloc and MEM_free with you own routines.
Roger Kingsley
----- Original Message -----
Date: Tue, 15 Nov 2005 18:59:13 +0530
From: "Ganesh Vijayan" <ganesh@gane...>
Subject: Re: memory allocastions in DSP/BIOS
Hi,
In case you allocate memory using MEM_alloc, you can free it by "free"
itself. You needn't use MEM_free. Alternatively, if you are using XDAIS
framework, even size information is stored in the memTabs which you can
use.
Hope this helps.
Ganesh
----- Original Message -----
From: alonla@alon...
To: c6x@c6x@...
Sent: Tuesday, November 15, 2005 6:35 PM
Subject: [c6x] memory allocastions in DSP/BIOS
Hi all,
Using the DSP/BIOS operatinf system, I have hard times with the memory
allocations.
I want to use 'MEM_alloc' / 'MEM_free' instead of using 'new' and
'delete' (I work on C++).
The reson is : using MEM_alloc I can define the memory section to be
allocated in.
The problem is that in order to use MEM_Free, I need to know the size
to free, and this is too much..
Is there any simple solution to use MEM_alloc and MEM_free without
telling the DSP/BIOS the size I want to free?
Thanks,
Alon.

(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )
Re: memory allocastions in DSP/BIOS - alon...@rafael.co.il - Nov 20 5:22:00 2005
Ganesh,
I tryed to use 'free' function, after allocating with MEM_alloc, but it didn't work. I tryed
somthing like this:
while(1)
{
p1 = (char*)MEM_alloc(heap1, 100, 8);
p2 = (char*)MEM_alloc(heap2, 100, 8);
free(p1);
free(p2);
}
When I watched the memory using the "kernel/object view", I saw that when I try to
free heap2, nothing happens (heap1 is the default one). When I try to free heap1, the
"kernel/object view" window reports a negative values, and I figure that it doesn't
work properly eather.
Did you use MEM_alloc and free function with a better results?
Alon.

(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )
Re: Re: memory allocastions in DSP/BIOS - ahsan khan - Nov 21 2:40:00 2005
hey Alon....
To free the memory allocated with 'MEM_alloc', you should use
MEM_free(segid,ptr,size). i.e in your case
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);
}
hope this solves your problem
hasan
a...@rafael.co.il wrote:
Ganesh,
I tryed to use 'free' function, after allocating with
MEM_alloc, but it didn't work. I tryed somthing like this:
while(1)
{
p1 =
(char*)MEM_alloc(heap1, 100, 8);
p2 = (char*)MEM_alloc(heap2, 100, 8);
free(p1);
free(p2);
}
When I watched the memory using the "kernel/object
view", I saw that when I try to free heap2, nothing happens (heap1 is the
default one). When I try to free heap1, the "kernel/object view" window reports a negative
values, and I figure that it doesn't work properly eather.
Did you use MEM_alloc and
free function with a better results?
Alon.
<*> To visit your group
on the web, go
to:
http://groups.yahoo.com/group/c6x/
<*> To unsubscribe from this
group, send an email to:
c...@yahoogroups.com
<*
Yahoo! FareChase - Search multiple travel sites in one click.

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