Hi All, I have implemented a linked list in my program on infineon sle66c168PE. at very first time i intialize the starting node with the null value and whenever i need to add the node to the linked list the malloc function return me the value 0x0000 that is a null value.which causes the program to fail. can anyone please suggest me something to work-around this problem... its very urgent ...Plz Thanks and Regards, Ankit
In the case of embedded systems, however, you typically know the total amount of RAM as well as how much of that RAM you can afford to devote to storing your data. I'd add that in addition embedded systems generally need to guarantee operation for certain specs. You can't just throw up an "out of memory" dialog box and quit back to the OS if you run out. You have to plan ahead of time and be sure that you will be able to allocate N foos simultaneously with M bars at run time. When malloc (and the like) does show up, it's generally part of some sort of base configuration code. Perhaps a system can support up to 32 foos, or 64 bars, or some combination where every foo costs you 2 bars, and the user can select that tradeoff. In that case, I might allocate a pool of foos and a pool of bars out of a shared memory area. I might even use malloc, though its overhead is generally unnecessary in this case, since the memory will never be freed (until the system is reconfigured). I commonly have code that dynamically allocates one item out of a table devoted to storing those things, but that's not the same as dynamic allocation from a generic shared, variable-sized memory heap, which brings lots of performance, fragmentation, and correctness questions, without adding much value.
simply: take that PC hat off and put a '51 hat on. Do not go by the urban legend "If you can do C, you can do any processor" Erik