View Single Post
javispedro's Avatar
Posts: 2,355 | Thanked: 5,249 times | Joined on Jan 2009 @ Barcelona
#69
Technically, programs are always 'running' in PalmOS. This is because there's no distinction at all between storage and memory, and thus there's little difference between an "unloaded" and a "loaded" program in PalmOS (the difference is, basically, whether globals have been allocated or not).

In fact, e.g. if you created a socket and used the asynchronous IO equivalent to listen() or read() from it (more or less equivalent to Linux AIO's raise a signal when IO finishes), you would quickly realize that your signal callback would be called _even after going back to the launcher and switching programs_. That is how my 'background' FTP server for PalmOS worked.

Similarly, it was easy to malloc() something that would leak even if you 'switched' programs.
However, this was not the default. In practice, PalmOS worked like Android. When you get the notification that the user is going to the launcher, you just free() everything (or as much as possible). When you get launched, you load stuff back.

Unlike Android, no one would kill or "SIGSTOP" you if you decided to not free() everything.
 

The Following 5 Users Say Thank You to javispedro For This Useful Post: