Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7303

General • Re: PT52-Lua The Modern Retro computer

$
0
0
Nice implementation using a memory pool! I just read the NewLib rand() may call malloc(), not saying you use rand(), but whoa, what a gotcha!

https://dunkels.com/adam/rand-may-call-malloc/
All calls to malloc are redirected to the memory pool in PT52-Lua. The test code has a split memory heap, so malloc calls fetch memory off the heap and pt_malloc calls grab memory from the pool. So that malloc if present might be a problem if it doesn't clean up after it's done.

The only code I could find that does call malloc is in the scanline library I'm not about to rewrite that... no I've got a plan for that.

Now I'm looking at signals and how to deal with them as I have them but it looks like I can't use sigpending and some others, Since I have code that uses longjmp you can't trigger that from an interrupt or a signal handler. Working on work arounds....

I've added a signal flag in the VRAM where signals can set the flags for a signal processor in Lua to handle.I've just used a signal handler in the script executor to look after signals and that works much cleaner. ^C works on PT52-Lua so what is different in testing I'm not using Lua to run script I've written a light weight executor that doesn't the executing and streamlines the memory pool access. so I wanted to have this poll for signals and act on them as needed.

Statistics: Posted by DarkElvenAngel — Wed Feb 05, 2025 1:14 am



Viewing all articles
Browse latest Browse all 7303

Trending Articles