|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Dynamic Memory Allocation Woes
I'm sorry I didn't do some more searching before I posted. Thank you very much. However, how would it be possible to use the stack for my purposes? The point is that I don't want to have a fixed number of my memory blocks, which unless there's a way I'm not thinking of, is impossible in stack memory.
|
|
#2
|
||||
|
||||
|
Re: Dynamic Memory Allocation Woes
The thing is, you *do* have a fixed amount of memory, because of the limitations of the hardware. This isn't like the 4GB address space you're used to on a PC. I think you're far better off taking a static block of memory that is as big as you'll ever use, and build your data structure in there. It's not like you have to share your memory with other applications. I really can't think of anything that you could feasibly do with dynamic memory on the IFI controller that you couldn't also do with static memory, and it seems like you'd save yourself a huge pain in the process.
|
|
#3
|
||||
|
||||
|
Re: Dynamic Memory Allocation Woes
One other thing that we've found over the years is that pointer arithmetic on the RC processor is extremely costly. You may want to look at the .lst file that is generated when you build to see how much assembly is generated for pointer operations that you wouldn't bat an eye at on a desktop computer.
You may be better off storing an array of points as opposed to a linked list. If your points are sequential, there's no need to keep anything other than a simple index variable. If you're going to jump around inside the array, you'll need at least a second variable to index to your next point. |
|
#4
|
|||
|
|||
|
Re: Dynamic Memory Allocation Woes
I would use an array or shove the coordinates in the EEPROM. It takes a bit to read, but you can queue up values as you do other things. I'd probably make my "stack" 3 objects deep. (No calculated reason, just seems right to me..
) |
|
#5
|
||||
|
||||
|
Re: Dynamic Memory Allocation Woes
Thanks to everyone for the help. A few responses:
Yes, I realize that I am using a fixed amount of memory regardless. My main concern was being able to insert points within my list, as opposed to having a set sequence of points. I suppose this could be done with a three-dimensional array. The first two dimensions could hold my coordinates, and the third dimension could determine which indice of the array comes next. If I really want, I could also use some bitwise with the upper digit of the third value to determine if that array indice is in use. Thanks for the ideas Slavik Last edited by slavik262 : 12-02-2008 at 16:22. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Random Allocation of Trackballs | fabalafae | Rules/Strategy | 7 | 07-01-2008 09:31 |
| Please help: Memory allocation problem dealing with sections | RbtGal1351 | Programming | 10 | 14-03-2006 14:58 |
| Animation Woes | Team905Animator | 3D Animation and Competition | 1 | 15-02-2005 16:34 |
| Transmission Woes | Madison | Motors | 3 | 19-02-2002 10:06 |
| Gear Woes | Simon G | Technical Discussion | 14 | 24-01-2002 16:31 |