Hi,

> I use windows XP, Windows 7 and win32::GUI 1.06. Problem exists on the both
> OS`s.

What version of Perl are you using?

> It is not problem with win32::GUI but I experienced it just using the module
> in my application.
>
> My application dynamically generates series of windows (potentially
> unlimited). Each of those is full Win32::GUI object with all the staf:
...

I also have a dynamic windows interface, but not as large as yours. 

>
> Here is the perl script which shows the problem. On my machine the error of
> "Out of memmory" appeared after a little over 4000 iteration - it depends on
> the machine. Not always this writing happens - very often just stops with
> strange background colors (black for the example).

On my machine, your script hardly leaks at all (Win32::GUI 1.06, Perl 5.8.9). I would need to run your script for at least 100,000 iterations before memory becomes an issue?

When you get strange colors it usually means your script is not freeing windows handles (which are created/destroyed automatically by win32::gui). Your script isn't leaking handles either.

> My question: Does anybode can show me how I could use the memory of deleted
> objects again? Please look at the example: The address of the object is going
> up and up... How to stop it? In the code I just delete the object so it is
> obvious that the memmory is free for reusing. Strange enough is the fact that
> the object which contains internal GUI window objects got the same address.
> What is going on? I was searching the Internet but not succeded - althoug they
> say in this area Perl sucks. Maybe Perl is not good tool for 'really' big or
> long working applications because of practical leak of memory?

Perl uses a reference counting methodology for it's memory allocation and memory is only freed when the count gets to zero. If the count never gets to zero (because of a bug or design issue, such as using circular links) then memory will never be freed. Perl is fine for large long running applications. 

In your example the small memory leak looks like a bug within Win32::GUI. 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. 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).

Cheers,

jez.