I have a cdev that dynamically loads code using initialLoad. In that
code I use quite a bit of mallocs to allocate memory. In start up code
of my dynamically loaded code I make the following calls to initialize
the environment so I can use malloc.
SystemUserID(dataIn->userID, NULL);
SystemMinStack();
SystemEnvironmentInit();
Everything work in my code without issue. On exit from the dynamically
loaded code back to the calling CDEV code I sometimes get an error
about being low on memory and needing 400kb of memory...but I have
allocated 8MB to the system so I know it is not that. Is there
something I need to call to shutdown the environment to prevent this
error? I can avoid this error by calling reboot after the code is done
but that is not a solution. I never see any sort of memory corruption
so I don't believe it is that.
On 2020-11-22 20:57:49 +0000, vavr...@gmail.com said:
I have a cdev that dynamically loads code using initialLoad. In that
code I use quite a bit of mallocs to allocate memory. In start up code
of my dynamically loaded code I make the following calls to initialize
the environment so I can use malloc.
SystemUserID(dataIn->userID, NULL);
SystemMinStack();
SystemEnvironmentInit();
Everything work in my code without issue. On exit from the dynamically loaded code back to the calling CDEV code I sometimes get an errorYou may need to call SystemMMShutDown() at the end of the dynamically
about being low on memory and needing 400kb of memory...but I have allocated 8MB to the system so I know it is not that. Is there
something I need to call to shutdown the environment to prevent this error? I can avoid this error by calling reboot after the code is done
but that is not a solution. I never see any sort of memory corruption
so I don't believe it is that.
loaded code. That should deallocate everything that it allocated.
Note that this will call DisposeAll() on the user ID that the ORCA
libraries were using (which is the ID you specified or'd with $0100),
so make sure that you are done with anything allocated under that ID
before calling it.
(This is handled automatically in a typical S16/EXE program that exits
by calling exit() or returning from main(), but it sounds like that's
not what you're doing.)
--
Stephen Heumann
I am calling GetNewID(0x5000) rather than just or'ing it with the assigned ID.
I narrowed it down a little more in my code which just confuses me more
;) During bootup the cdev load some dynamic code to handle request events...much like a PIF would do. The PIF and the CDEV will load an additional dynamic code and execute that....and free it when it is
done. Calling the dynamic code from the CDEV seems to have no issues.
It is on returning from the PIF that seems to cause the finder issues.
SystemUserID(dataIn->userID, NULL);
SystemMinStack();
SystemEnvironmentInit();
What toolset or library are these calls from? I don't see documentation
for them in any of the 3 toolbox volumes?
Thanks.
SystemUserID(dataIn->userID, NULL);
SystemMinStack();
SystemEnvironmentInit();
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 293 |
Nodes: | 16 (2 / 14) |
Uptime: | 219:09:44 |
Calls: | 6,621 |
Calls today: | 3 |
Files: | 12,171 |
Messages: | 5,317,854 |