Memory leak

Discuss macros to control the hardware functions of your ZEISS microscope
Post Reply
user-6850
Posts: 18
Joined: Thu Jan 01, 1970 1:00 am

Memory leak

Post by user-6850 »

Dear,

Hello.

I'm creating a macro using the "ZEN 2.6 system".
I'm making a TCP connection and running a macro from another PC.

When performing ZStack measurements, there is a memory leak problem.
(Change of objective lens, autofocus, ZStack measurement, output of CZI file and SUR file)

Executing "exp.Close ()". Is there any other processing that needs to free memory?

Thank you.
user-6850
Posts: 18
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6850 »

My explanation is not enough.

I'm doing "Documents.RemoveAll()"
user-4
Posts: 398
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

Hello Yosuke,

if your code contains something like:

image = Zen.Acquisition.Execute(experiment)

there should be a:

image.Close()

as well.

Documents.RemoveAll()

is not enough, as it just removes the image from the GUI but not from the code itself.
user-6850
Posts: 18
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6850 »

Hello.

My code is

-----------
Zen.Acquisition.Execute(experiment)
-----------

What should I do in this case?

Also, with another code

-----------
strImageName = Zen.Application.ActiveDocument.FileName
imgAct = Zen.Application.LoadImage(strImageName)
imgTop = Zen.Processing.Transformation.Topography.CreateTopography(imgAct,int(MaskMin),int(MaskMax))
Zen.Processing.Utilities.ExportTextureFromTopography(imgTop, IntFile)
Zen.Processing.Utilities.ExportHeightmapFromTopography(imgTop, TopFile)
Zen.Application.Save(imgAct, CziFile)
-----------

in this case, Is the following code OK?

imgAct.Close()
imgTop.Close()
user-4
Posts: 398
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

Hello Yosuke,

yes, in your case

imgAct.Close()
imgTop.Close()

is a must, as you have to close each individual image that you address in the code!
Otherwise the image is still 'around'.
Post Reply