Page 1 of 1 1
Topic Options
#204740 - 2012-04-16 07:18 AM KiXforms classic - properly dispose of a form
It_took_my_meds Offline
Hey THIS is FUN
*****

Registered: 2003-05-07
Posts: 273
Loc: Sydney, Australia
Hi All,

Does anyone know of a method to properly dispose of a form in KiXforms classic? I've tried to use .dispose or setting the variable to nothing but I have no luck, the memory is not released. I've even tried recursing through the controls and tried to dispose all of the child controls before disposing of the parents, but again I had no luck.

This is a problem for me as I have a pretty large application where people can open up forms that have lots of controls. What can happen after repeated usage is that the GUI goes gooey and I'm pretty confident it is due to memory usage. I'm 95% percent confident that this is simply a bug in KiXforms that I won't be able to escape... but you never know. If I'm truly lucky Shawn may have something to say ;\)

Just step through this code and watch task manager, the memory just keeps going up and up.

 Code:
Break on

$s = CreateObject("Kixtart.System")
Debug on
For $i = 1 to 100
	$f = $s.Form
	$f.Dispose
	$f = ""
Next


Any ideas?

Top
#204741 - 2012-04-16 10:05 AM Re: KiXforms classic - properly dispose of a form [Re: It_took_my_meds]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
Did you try
 Code:
$s = CreateObject("Kixtart.System")
Debug on
For $i = 1 to 100
	$f = $s.Form
	$f.Dispose
	$f = ""
Next
$s = ""

Just to see if the memory is cleared up ?

Top
#204742 - 2012-04-16 11:23 AM Re: KiXforms classic - properly dispose of a form [Re: Arend_]
It_took_my_meds Offline
Hey THIS is FUN
*****

Registered: 2003-05-07
Posts: 273
Loc: Sydney, Australia
Hi Arend,

I hadn't until now, but it still doesn't make a difference. In any case, killing the system object would kill the main form of my app so it wouldn't be feasible.

I have noticed that the working set memory usage of my above example is quite different between my workstation at work and my laptop at home. The memory increase for each form is much greater on my work computer. My work computer has 3 monitors so that may be a difference.

Regardless it still a problem on more than just my work machine.

Top
#204743 - 2012-04-16 01:52 PM Re: KiXforms classic - properly dispose of a form [Re: It_took_my_meds]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
Well, I would have expected clearing the $s variable to at least release the memory used by KiXforms, but seeing as that didn't happen I would not expect KiXforms to be the problem but KiX itself, did you try another KiX version?
You might have a different KiX version on your laptops and workstation as well?

Top
#204744 - 2012-04-16 02:18 PM Re: KiXforms classic - properly dispose of a form [Re: Arend_]
It_took_my_meds Offline
Hey THIS is FUN
*****

Registered: 2003-05-07
Posts: 273
Loc: Sydney, Australia
Hi Arend,

It is the working set memory associated with the process that is building up, not the private working set of the kix executable. Maybe someone with better understanding of how COM memory works could jump in here. The way I figure it is that the memory that is growing is the sole domain of the KiXforms dll and it is not releasing its resources as it should. I think the dll's memory is only unloaded once the parent process actually terminates. I believe this as the undelying dll remains file locked until the parent process exits.

Regards,

Richard

Top
#204745 - 2012-04-16 04:34 PM Re: KiXforms classic - properly dispose of a form [Re: It_took_my_meds]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
I ran into similar issues not too long ago...

http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=203747

Top
#204746 - 2012-04-16 04:47 PM Re: KiXforms classic - properly dispose of a form [Re: ShaneEP]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I know my memory is not what it used to be, but indeed, if you destroy the forms and in this case also the system-object, the memory should be released.

why you don't see it happening with this example might be because windows doesn't need the memory, so the cleaning of excess memory from kixtart/kixforms process is given low priority.

we did run into memory issues with my bbchecker years back and indeed disposing a form or just reusing it instead of creating a new one did change the memory usage.
_________________________
!

download KiXnet

Top
#204749 - 2012-04-18 01:24 AM Re: KiXforms classic - properly dispose of a form [Re: Lonkero]
It_took_my_meds Offline
Hey THIS is FUN
*****

Registered: 2003-05-07
Posts: 273
Loc: Sydney, Australia
Thanks Lonk, reusing forms may be the answer.
Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.058 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org