Tamas Rudnai escreveu: > On Tue, Oct 6, 2009 at 3:24 PM, Isaac Marino Bavaresco < > isaacbavaresco@yahoo.com.br> wrote: > > = >> Indeed, your heap must be declared as a normal variable (big array of >> char) so the compiler and linker locate it properly. If you just use an >> address range you *think* is not in use then next time you link it, it >> may be on top of some other variable. >> >> = > > I think it is more common to declare a chunk of memory in linker script so > that area will not be used by the linker therefore free to use. With a > variable it could happen that the compiler thinks that it was not used and > then the optimization chops it off... > > = Yes, you will need to change the linker-script to define an area big enough for your heap, but you must declare also a variable so you can take its address, initialize it, etc. There are other approaches, usually needing knowledge of the compiler=B4s internals (automatically defined symbols, etc). When the compiler manufacturers provide heap management they make the compiler help/know about it. Without this "privileged" knowledge the simplest way is to declare it as a a big array, and it is more portable too. > BTW: I think what Olin is trying to express is that a dynamic memory > allocator needs an overhead plus some trouble with the memory fragmentati= on > so overall it is not the best choice for a small device. > > Tamas I use FreeRTOS with PIC18 and dsPICs and it doesn't work without dynamic allocation. Best regards, Isaac __________________________________________________ Fa=E7a liga=E7=F5es para outros computadores com o novo Yahoo! Messenger = http://br.beta.messenger.yahoo.com/ = -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist