maybe it is not unloaded immediately. And have you ldg.prg in the auto folder? And how to you display the available mem, if you just display the largest block, it might just have been fragmented.
I tried with ldg.prg in auto folder, same behavior.
I'm using Mxalloc(-1, 0) and Mxalloc(-1, 1) to get available ST & TT RAM (Malloc(-1) on old systems). Not sure if it is full memory or largest block. Does somebody know how to get full memory available?
Is there any tool which can display in "real time" the amount of ST/TT RAM available ?
How can the app implement a smart unload if it does not know about the dependencies? zlib for example is used by several modules. For that to work, the app needs at least to maintain some kind of reference counter. And that can also only been done by the app since the modules don't know about each other.
Interesting point. I would expect SLB open/close functions to take care of that. slb_open/slb_close should maintain some global counter on the number of times this lib is referenced. When this counter gets to 0 on slb_close, code memory should be freed.
Let's take an example:
app loads png sbl which loads zlib SLB.
app loads jpg slb which loads zlib SLB.
At this point, there is: 1 instance in memory of png, jpg and zlib code, usage_counter(png)=1, usage_counter(jpg)=1, usage_counter(zlib)=2
app unloads png slb:
png slb unloads zlib SLB, so usage_counter(zlib)=1, it stays in memory, usage_counter(png)=0, it is released from memory
app unloads jpg slb:
jpg slb unloads zlib SLB, so usage_counter(zlib)=0, it is released from memory, usage_counter(png)=0, it is released from memory
Of course this counter mecanism is shared across all applications as we are in a mutitasking environment.
That is how I would expect SLB to work, but I may be wrong. If so, maybe it's time to enhance this dynamic modules design instead of pushing that management to apps.
Thorsten, on zvSLB plugin model, app provides slb_open/close callbacks to plugin because it saves memory/helps plugin dev or because there is no other choice: plugin has to get back to app for SLB loading? What would happen if plugin loads SLB directly without using this app callback?