> On 24 Mar 2020, at 13:49, Christof Ressi <[email protected]> wrote: > > I think a stack of 16 kB should be enough, but watch out for certain objects > that might do large stack allocations, e.g. [sigmund~]. A modern OS usually > has a stack size of at least 1 MB... > > Regarding heap memory, you could get a rough idea by writing a small libpd > test program on your Desktop with Pd's memory debug option or some external > memory debugging tool like valgrind. > > Also don't forget that the code itself also has to be loaded into memory. > Then there are of course the actual Pd patches, which also need memory. > > Finally, note that depending on the actual memory allocator, memory usage > might not be deterministic. There are things like heap fragmentation to look > out for. Pd might do heap allocations repeatedly during run time, e.g. > [vline~] or any list larger than 100 atoms, and with such a small heap, > fragmentation is very likely. One bigger allocation and boom - you're > basically out of memory. > > I don't know whether it's much fun to use Pd in such a constrained > environment. Sound very brittle to me... You might be better of with an > actual signal processing library, where you can control every aspect of your > program.
That’s more and more on my mind. Since the pd code I’m trying to move to microcontroller is not that simple I dread I’ll have constant problems with memory. I’ll look into what I need for signal processing regarding the code I’m porting and see what I can do here. > > Is there anyone who has actually used or tried to use libpd under such > extreme memory constraints and can share their experience? > > Christof Thanks. B. > > On 24.03.2020 11:49, Boštjan Jerko wrote: >> Do you know what are the minimum values for the stack and heap? At least >> rough estimation. >> >> B. >> >>> On 24 Mar 2020, at 11:30, Christof Ressi <[email protected]> wrote: >>> >>> Check how much memory Pd is using. I mean, a 16 kB stack and 130 kB heap is >>> still pretty small... (if those hex numbers mean bytes). Pd hasn't really >>> been designed to run on microcontrollers ;-). Anyway, have a look at >>> m_memory.c, there are some heap memory debug options, in case your >>> developer tools don't provide this. >>> >>> Christof >>> >>> On 24.03.2020 09:25, Boštjan Jerko wrote: >>>> I don’t use PDINSTANCE, but after checking some online stuff I thought >>>> maybe the size of the stack is the problem so I’ve changed it from 0x400 >>>> to 0x4000 and heap size from 0x200 to 0x2000, but no success. >>>> Still - I guess there is something going on with the memory so I’ll be >>>> checking this some more. >>>> >>>> >>> >>> >>> _______________________________________________ >>> Pd-dev mailing list >>> [email protected] >>> https://lists.puredata.info/listinfo/pd-dev > > > > _______________________________________________ > Pd-dev mailing list > [email protected] > https://lists.puredata.info/listinfo/pd-dev _______________________________________________ Pd-dev mailing list [email protected] https://lists.puredata.info/listinfo/pd-dev
