CLOSE WINDOW always?

After looking at tech tip https://kb.4d.com/assetid=78492 on memory leaks, I am wondering if CLOSE WINDOW is needed in the following to prevent a memory leak.

$w:=Open form window(“SampleWin”)
SET WINDOW TITLE(“New Sample”;$w)
DIALOG(“DepositNew”)

DIALOG seems to take care of CLOSE WINDOW, maybe not?
Would CLOSE WINDOW be needed if the process ends after the call to DIALOG?

I got out of the habit of using CLOSE WINDOW in these specific circumstances after removing the command stopped 4D from crashing in a long ago version.

Thanks,

Keith - CDI

My understanding is that 4D 32-bit before v12 was using the actual low-level window reference. Now, 4D is returning a number that resolves as a reference (which is 64-bit). That might explain the crash situation.

Normally a CLOSE WINDOW after DIALOG is optional, especially if the process dies out. Notable exception is when you pass the * to spawn a new event loop. You must omit CLOSE WINDOW in that case.

The worst thing is to use CLOSE WINDOW but without the window number. The frontmost window might not be the one you think.