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.
memory allocastions in DSP/BIOS
Started by ●November 15, 2005
Reply by ●November 15, 20052005-11-15
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.ilTo: c...@yahoogroups.comSent: Tuesday, November 15, 2005 6:35 PMSubject: [c6x] memory allocastions in DSP/BIOSHi 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.
Reply by ●November 16, 20052005-11-16
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.
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.
Reply by ●November 20, 20052005-11-20
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.
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.
Reply by ●November 21, 20052005-11-21
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);
}
{
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:
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.