raisch@Control.COM (Robert Raisch) (06/05/91)
PROBLEM: Windows loses between 3 and 5 kbytes upon the *first* invocation of numerous programs. BEHAVIOR: Before I invoke WhiteWater Group's ACTOR programming language on an ancient IBM-AT with 2048K of memory, Windows reports 1112Kb free, (this included the invocation of Usher that I use instead of the PROGMAN.) I then invoke ACTOR and am told that I have some 488Kb free. Leaving ACTOR, Windows reports 1108Kb available. Re-invocations of ACTOR do *NOT* eat up any more memory. It has been reported to me that other applications will also eat up memory, ONLY UPON THEIR FIRST INVOCATION. THEORY: To the best of my knowledge, Windows saves window subclass structs and paint structs. Since the apps that I have used do not use paint structs, I *believe* that this problem is Windows not releasing window subclassing structs back to the memory pool. If this is true, this is a SERIOUS bug. PROOF: If someone with more time and expertise under Windows could create two simple programs, one that creates a new window subclass and then realizes a window of that type, and the second which then tries to realize a window of the same type, ONCE THE FIRST PROGRAM HAS ENDED, this would prove the theory. I would like to hear reports regarding this problem. And if someone more knowledgable than I in Windows programming could try to track this down, I would be very appreciative. Regards /rr (Robert Raisch, Manager of Software R&D, Control Technology Corp) -- "I ate his liver with some fava beans and a nice chianti." -Lector
press@venice.SEDD.TRW.COM (Barry Press) (06/05/91)
<Long message about theories where memory is going on first invocation deleted> In programming a number of winapps, I can tell you from experience that the following does occur. If this is indeed responsible for what you're seeing, it's due to a change from win2 to win3 that has not been reflected in all applications. When an application starts, it registers one or more window classes, and then creates windows of those classes. Under win2, you didn't have to do anything special to cause the registrations to go away when your application exited. Under win3, I have seen that applications I've written that do nothing about this issue leave 3 or 4 (as I recall) memory blocks allocated. If, just before the WinMain function returns I do a call to the (new for win3) UnregisterClass function, then those blocks go away. I don't recall how big the blocks were, so can't be sure this is what you're seeing. If it is, however, then the problem is not win3 per se, but a change from win2 to win3 not being understood by all developers. This would be true even for new winapps under win3 -- if you don't unregister the window classes, you'll leave allocated memory. And yes, it only happens on the first execution, since after that the class is either not registered again or else the registration attempt fails (silently, I presume, on the part of the application). -- Barry Press Internet: press@venice.sedd.trw.com