> > What version of Perl are you using?
>
> Perl 8.8 and Perl 10.0 (both ActiveState's) - results the same

I assume that's perl 5.8.8?

It may be worth downloading the latest version of either 5.8 or 10.0 as I know there were fixes in Perl itself that could be causing your problem. 

> The most interesting fact in this second case is the behaviour of Prima 
> windows when I comment the close method out. Then I see on the screen all the 
> windows created one after another! And - of course - MAD effect arises. 

> Mayby all the problem is that I do not use in Win32::GUI a similar method to 
> that ->close() ? But I can not find it though. 

With Win32::GUI you shouldn't need to do anything. Once the object goes out of scope, all resources should be released.

> > It's likely that the issue you are having in your
> > application is that you are storing references to Win32::GUI objects in
> > different places so the reference count never gets to zero thus the object
> > isn't destroyed.
> But what about my example?
> Jez, add a loop which adds to one window say 200 labels or textfields and check
> what will happend. On my machine it needs 100-150 iterations to blow up. It is
> not a "theoretical" example I have attached. I believe if I could fix the MAD
> problem in the simple example then I could repair my application.

Your example runs fine for me. With 400 labels and 4000 iterations, I leak about 128K. Handles, User Objects and GDI objects don't leak either. At the end of the run, your script uses 5MB. I am using Activestate Perl 5.8.9 build 827.

> > I've found the "big memory problems" are associated with
> > leaking windows handles and GDI objects (open task manager and display
> > these columns, if they keep increasing then you need to work out why).
> I can't fine the windows handles and GDI objects in my task manager - where are
> they?

Open Windows task manager, then under the view menu you should see Select columns, then select Handles, User Objects and GDI objects. 

If handles, user objects or GDI objects keep increasing in number then you'll end up with a serious problem - strange colors or wrong bitmaps painted can sometimes be seen.

Cheers,

jez.