Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!zaphod.mps.ohio-state.edu!mips!apple!portal!atari!kbad From: kbad@atari.UUCP (Ken Badertscher) Newsgroups: comp.sys.atari.st.tech Subject: Re: Malloc() and desk accessories Message-ID: <2266@atari.UUCP> Date: 2 Sep 90 23:27:35 GMT References: <13263@hydra.gatech.EDU> Organization: Atari Corp., Sunnyvale, CA Lines: 38 gt1448b@prism.gatech.EDU (David P. Forrai) asks: | What is the correct way to call v_opnvwk()? Should it be done before | the event loop and v_clsvwk() never called? The best way for desk accessories to handle opening virtual workstations is for them to use them in the same way they would use any other dynamically allocated resources. Open the workstation, do VDI calls, close the workstation. It isn't a good idea to suck up a virtual workstation slot which may never be used. You're right, if that's what ACSKEL does, the behaviour in ACSKEL is incorrect. The effects of dynamic DA Malloc() and v_opnvwk() calls only recently became apparent, when the GEMDOS internal memory management was improved for TT TOS. A side effect of the change he made was that the likelihood of a freed block getting reallocated soon after being freed became much greater. In previous TOS versions, it takes longer for freed blocks to be reallocated. Because of this, you are less likely to see problems arise when DA's don't get a chance to clean up after themselves. It is still and always will be A Bad Idea to mess with memory you don't own, and that's effectively what DA's do if they dynamically Malloc memory (either directly or indirectly). To end on a happy note--the problem of DA's not getting a chance to free up their resources before having them yanked out from under them is FIXED in the AES version 3.0. The AES now actually waits until all desk accessories are back in an event wait before allowing an appl_exit caller to terminate. The new Control Panel (XCONTROL) takes advantage of this fact, and dynamically allocates memory to load Control Panel Extensions if it sees that it's on a TT. This should also be a great boon to desk accessory text editors and the like. -- ||| Ken Badertscher (ames!atari!kbad) ||| Atari R&D System Software Engine / | \ #include