Should it not start at lower end with first unused gap? (the other way round)
The module loader (procedure Modules.Load) could of course do that, but starting with mod = Modules.root is just the simplest possible code. Doing it the other way around would also be only a single line of code, but one would need to traverse the *entire* module list find the best fit at the "lower end". You can try to refine the module allocation/deallocation strategy. However, this is one area where it was thought that this would be an optimization in the wrong place. On "production systems” module unloading is rare, whereas on development systems, one generally tends to unload “the last loaded” module anyway. And for that, the few lines of code I provided are entirely adequate. A much more significant contribution would be to make module unloading “safe”, i.e. prevent unloading of there are still client, type or procedure variable references.
On Sun, 30 Dec 2018 22:02:31 +0100 Andreas Pirklbauer <andreas_pirklbauer@yahoo.com> wrote: Hi Andreas,
starting with mod = Modules.root is just the simplest possible code. Doing it the other way around would also be only a single line of code
The above would satisfy my needs, being non proficient coder but more developer than a user, I tend to load/unload very frequently. I would like to take this as my exercise [a]
but one would need to traverse the *entire* module list to find the best fit at the "lower end".
And this as an exercise [b], if needed. Can you please just give me a small hint (*comment*) in the code for [a],[b], I will try then on my own. Many thanks. -- Tomas Kral <thomas.kral@email.cz>
participants (2)
-
Andreas Pirklbauer -
Tomas Kral