I have done some more tests now with your settings in DevLinker
and I can reproduce your observed anomaly pretty well.
When I start BB with your linker settings without any further changes I can open a file dialog after startup of BB without any problem.
As the next step I run the following test program and get a stack overflow trap as expected because there is an endless recursion.
Code: Select all
MODULE TestStack;
PROCEDURE Recurse*;
BEGIN Recurse
END Recurse;
END TestStack.
Execute the command: TestStack.Recurse
When I then open a file dialog (e.g. with File->Open...) I get the anomalies.
Small black boxes for icons or sometimes even a trap with WinDlg.CommDlgExtendedError() = 2 indicating an out-of-memory error
from calling one of the Windows common dialog controls functions.
My interpretation is this: executing TestStack.Recurse allocates stack memory from the reserved stack address range of BB until the stack overflows.
The allocated stack memory is not deallocated after the stack overflow for efficiency reasons, i.e. the physical stack size grows dynamically.
Only the stack pointer is reset in the trap handler such that BlackBox can continue normally.
However, it is surprising that there is an observable side effect here because the reserved address ranges
are not changed at all by calling TestStack.Recurse. Only the Windows source code could explain that side effect, I guess.
Last but not least I changed the heap size in Kernel.AllocHeapMem as I described in a previous posting
from 1536 to something smaller, e.g. 1024:
Code: Select all
PROCEDURE AllocHeapMem (size: INTEGER; VAR c: Cluster);
(* allocate at least size bytes, typically at least 256 kbytes are allocated *)
CONST M = 1024(*1536*) * 100000H; (* 1.0 (1.5) GByte *)
and linked a new exe file and started that new exe file and the anomalies went away
even after calling TestStack.Recurse.
For linking a new exe file you can use the linker command in Dev/Docu/Build-Tool.odc.
I repeat it here:
Code: Select all
DevLinker.Link BlackBox2.exe := Kernel$+ Files HostFiles StdLoader
1 BlackBox.res 1 Applogo.ico 2 Doclogo.ico 3 SFLogo.ico 4 CFLogo.ico 5 DtyLogo.ico 6 folderimg.ico 7 openimg.ico
8 leafimg.ico 1 Move.cur 2 Copy.cur 3 Link.cur 4 Pick.cur 5 Stop.cur 6 Hand.cur 7 Table.cur
You have to start BlackBox
2.exe in order to make the changes effective.
To me it seems that there has been an error in your experiment when changing the constant M.
- Josef