# Beta 9 (Win 64) and persistent old habits

Posting rules: It shouldn't need saying, but... play nice. Please keep your discussions civil. You can disagree, just don't be disagreeable. And, of course, all of the usual stuff like no spamming. Tex adds: I'll be rigorously enforcing this as we go along. We're probably going to be a small community in a little lifeboat, so we can't have members at each others' throats. This is for the sake of the project as a whole. So when you post, pretend you're speaking in person with your very wealthy auntie who has always treated you wonderfully and currently lists you prominently in her will. I won't be tossing anyone out of the forums because we are all in this together (except spammers: immediate membership cancelation), but I'll delete suspect posts right away.

35 posts / 0 new
Jacal
Beta 9 (Win 64) and persistent old habits

I apologize, I have mentioned all this before and I am aware it is boring. Still, it might indicate some installer glitches, if it is not just showing problems with my (three) windows 7 installations. Tested on computers with different amounts of RAM (4, 8, 16 GB). It looks specific for beta versions on windows, at least ver. 6-9. Does not happen with ver. 4.0 (win) or in my virtual Ubuntu.

Shrinking Memory Limit

On a PC with 16 GB of RAM, after (re)installation or after resetting LZ settings Lightzone offers 3641 MB memory limit, then this number decreases in predictable steps - 3237, 2878 ...- every time I close and reopen the programme. Few launches later it shows maximum of 1420 MB available. Which seems to have real impact, I was able to make LZ using cca 4 GB after installation, now it can't go over 2 GB even during a ridiculously heavy testing task (and with plenty of computer memory available). In any case it doesn't release any RAM when the task is over and it goes back to browsing mode. Resetting the preference gives me back my 3641 MB, with number decreasing again with every relaunch.

Decreasing of memory limit goes further, my current "record" on this PC is 997 MB, and LZ actually only uses 1 GB maximum. Can anyone reproduce this? Opening and closing LZ and checking the memory limit should be enough, no editing necessary.

Recreating of Application Data folder on Win7/64

I wouldn't even mention this (again), but maybe it is in some way indicative.

In changelog for beta 5 under bug fixes Masahiro wrote:

On Windows 7 and 8, installer now uses "AppData" folder instead of "Application Data"

And so it does. Fresh install on two fresh windows 7 machines, one of them virtual: \LightZone\Caches is created in AppData.

On my working computer all LZ versions since 3.9 have been installed and no matter how I am trying to find and remove remnants of old installs in registry and on disk to make a really clean install, LZ somehow 'finds out' it should create a brand new Application Data folder and put caches there. So I presume some leftovers are hidden somewhere.

Thank you for your patience, cheers,

Mart

tex
Mart, you are one of our best

Mart, you are one of our best forum members....so we will never be impatient with you.  This is stuff I don't even bother to check, so i am glad you are.

dke
Shrinking memory limit

I can confirm that the memory limit in preferences shrinks after repeated starts of Lightzone 4.1 beta9. My system is Windows 7/64 too. The tiff reading problems I had in beta8 seem to be soved in beta9.

Regards, dke

Jacal
Thanks, dke,

I believe if you decide to monitor the actual memory usage, you will probably also see it shrinking. That is why I am posting this; if I am "right", Lightzone is permanently "loosing power", getting slower with time/usage/restarts. I would be rather proven wrong, of course. I didn't use the stopwatch yet, but it seems getting slower with heavy edits, until the settings get reset.

Have a nice day!

Mart

And, yes, tiff-related problems seem to be solved for win 7/64.

lintujuh
I can confirm

Hi,

I looked my prefs in beta8 and there the memory limit was down to 759 MB and no wonder my LZ has felt sluggish. The memory limit was carried over to beta9, when I upgraded my installation. After resetting the preferences I had 2181 MB (my total RAM is 8 GB) and after one restart I had lost some 200 MB from the upper limit.

-Juha

Odud
Also confirmed

After a reset of preferences the memory limit is 1091MB (I have 4GB of RAM). After a series of edits and restarts it has gone down to 603 MB. Is there an easy way to reset the memory limit without doing a full reset of preferences?

SFA
For those running Windows 7

For those running Windows 7 (and 8?) it may be worth firing up a Windows Resource monitor session, selecting the memory tab and then LightZone.exe as the Process to monitor (makes it easier) and then keep an eye on what happens as you work with LZ.

The numbers change and the more editing you undertake the larger the used memory figure becomes (I assume that some of that will be the history file size increasing). They seem to have no obvious connection with any numbers set in the preferences for LZ.

At least that's how I see it on my 64bit Win 7 Pro system.

I'm not sure the memory limit preference does anything unless running a pre Win 7 OS at 32bit. That the apparent limit value changes in the preference settings may not be very relevant  - although I fully agree that the value changes with each close down and restart of LZ.

For example, after a reset and then one re-start LZ preferences reports a limit of 3237Mb (down form something like 3640Mb iirc) but the Resource Monitor tells me that LightZone.exe has memory values of

Commit:    4,497,316 kb

Working Set:     4,382,496 kb

There may be more going on here that we might think at first sight?

Grant

Jacal
As said in original post, my

As said in original post, my experience is that memory limit preference actually limits memory usage. I have been using a home made "torturing style" and monitoring with process explorer. With initial setting of 3641 MB (on a PC with 16 GB RAM, win7/64) LZ can and does use cca 4 GB on this PC. When the setting shrinks to 1420  MB, actual usage stays under 2 GB, no matter what I do. Some relaunches later it becomes obviously sluggish, unusable for demanding tasks.

Perhaps a test with a stopwatch could be more convincing.

Cheers,

Mart

SFA
Mart,

Mart,

I can replicate the problem that you have described (or something like it - I did not try it step by step) but what puzzles me is that the Windows Resource Monitor numbers don't seem to have any relationship with the value set in the preferences.

Do you have Java 7 installed? It seems I don't and therefore cannot set a system wide value for Java memory allocation.

So we are relying on the bundled Java in LZ, which is fine - I think many applications do the same to ensure a known level of functionality - but I have no idea where the Preference value is stored. It may need some digging to find it.

However I looked at the LZ session Log file and find this message

"JavaAppLauncher checkWindowsVersion()
dwMajorVersion=6
dwMinorVersion=1
wServicePackMajor=1
= Windows Vista
May 22, 2014 11:07:20 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5."

I am wondering if this is of any significance for the problem and whether we would still see it if Java 7 was installed on the host system. Which was why I asked whether you had Java 7 (Shows as Javae 1.7 I think) installed.

Grant

Jacal
Physical memory usage

Computer: i5 3570, 16 GB DDR3 @ 1600 MHz

Other running programs: avast, process explorer, q-dir, irfanview, treepad lite, cyberfox, box, cryptsync.

Image: 18 MP CR2 (31 MB), small (default) _lzn.jpg, a stack of 42 tools (lots of bluring, sharpening, noise reduction etc.)

(WS Private is working set, shown by default in windows task manager)

A - after reset, memory limit 3641 MB

B - after 18 restarts, memory limit 555 MB

Zooming from FIT to 1:1

A: 3 min 1 sec

B: 4 min 50 sec

--

Grant,

I have no message in log file, only first 5 lines.

At the moment, I have java JRE 7.55 installed, both 32-bit (for libre office) and 64-bit (for my browser). I wouldn't know how to set a system wide value for java memory allocation though. Perhaps I will try to find out.

Mart

SFA
Mart,

Mart,

I found this a day or so back. Avoid the usual advert links.

http://www.wikihow.com/Increase-Java-Memory-in-Windows-7

The instructions look sort of like they probably should. It may be worth having a look to see what settings are already in place and whether they can be modified - IF the the JRE values are system wide rather than application specific as LZ is.

I'm interested to know what you find.

Grant

Odud
Tried setting the global Java

Tried setting the global Java memory limit to 2MB but it doesn't seem to have any effect. I guess LZ is using the version of Java that comes with it. I also tried renaming the jre folder in Lightzone to see if it would use the globally installed Java but LZ then fails to start.

SFA
Odud,

Odud,

Which LZ version/release are you using and can you confrm that you are on Windows 64bit?

I don't think LZ will use the system installed version of Java but I was wondering if it might use the same settings if it is installed. At the moment it looks like it is using LZ only settings and losing something along the way at each restart.

Grant

ETA. I have just seen your later posts so please ignore this .....

Jacal
Physical memory usage Part II

First to finish this boring test, with every restart the offered memory limit shrinks for cca 11.1 %. The lower limit (on this machine, of course) is 245 MB.

At 309 MB, my "FIT to 1:1" test took 18 minutes, so I didn't measure lower values. At 245 MB, LighZone was still a kind of usable, but slow. I did get a warning once, "Insufficient memory to open the file; Java heap space" and had to restart to open the image.

It was a rough day for me, so I was in the mood for boring repetitive tasks. Time for an evening walk. See you!

Mart

Odud
It looks as though the Java

It looks as though the Java parameters are in lightzone.jvmargs

I have tried changing these by adding

-Xms768m
-Xmx1024m
-d64

But I still see the memory decreasing after restart. A warning - if you mess up the parameters and put in incorrect values then LZ will fail to start. So keep an original version of the file around if you are experimenting.

Odud
I think that by putting the

I think that by putting the heap size arguments into the main class arguments as follows may be having an effect. I have done a few edits and the memory limit seems to be staying static at 971MB. Could someone else test and confirm?

# Main class arguments, if any.

-Xms768m
-Xmx1024m

Previously I had them in the JVM options section. As before experiment at your own risk...

Odud
I was wrong

Still going down, so I'm not convinced my fiddling did anything - will wait for the experts :-)

Odud
A possible workaround

Having had a good root through the source code and a quick delve into Java serialization I eventually found where Max Memory is stored in Windows. And yes it seems possible to change it without affecting any other preference settings. So until this issue is fixed I have created a Registry Editor file that I can run before I start LZ as follows:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\JavaSoft\Prefs\com\lightcrafts\app] "/Max/Memory"="1820"

Warning - editing the registry by hand can seriously mess up up your system - do this at your own risk

Jacal
"Why didn't I think of that!"

I have been in that part of registry more than once, searching for some other settings. Nice, thanks!

At least for me it still eats the first portion away, so to get my initial value (3641 MB) I have to set full 4 GB. If I set even more, LZ still starts with 3641.

According to my primitive test, first limit reductions have negligible impact on performance (I have updated my table above), so it is not necessary to reset the value every time. It takes some time  - days or even weeks in real life, depends on usage - for LZ to become noticeably slower.

And here and there, rarely - I have seen this only in early stages - the memory limit doesn't get changed after restart.

Mart

SFA
Mart,

Mart,

Your 11.1% reduction calculation seems to apply to the initial setting on first open as well. 4096 reduced to 3641.

If I open LZ, go into edit but exit without saving anything new then exit LZ the memory limit does not change.

However, edit and then save a file then exit and it does change.

So far I have not found a limit reduction when no edit/save type activity has occurred.

For example if applying a Style (randomly selected as a test) directly fomr the browser and writing a new .jpg lzn file,  the memory limit seems to be unchanged.

Grant

Grant

SFA
Interesting. I'm wondering

Interesting. I'm wondering how in my search through the registry I managed to miss that.

Well found Odud.

Grant

Jacal
My workaround

I am sorry, I decided to revive this since it still exists in LZ 4.1. Here is a simple workaround:

1. Create a .reg file, something like this:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\JavaSoft\Prefs\com\lightcrafts\app]
"/Max/Memory"="4096"

This is for Windows 7/64 computer with 16 GB of RAM. Change the number, if necessary, and consider Odud's warning.

2. Make a simple batch file; here is mine:

@echo off

regedit.exe /s "E:\path\to\file\yourregfile.reg"

start "" "C:\Program Files\LightZone\LightZone.exe"

Save it with .bat extension. Running this triggers UAC, if that bothers you, you can go to the next step:

3. Bypass UAC for this .bat file. You can do it manually, there are many instructions how to do this, or simply use this tool. Pin the shortcut to your start menu or desktop. You can change the icon and name then, if you want.

For me, this sometimes triggers LZ's request to reset the settings, but ignoring this works just fine.

Have a nice day!

Mart

tex
Thnaks for this

Sorry it's still an issue in v4.1.  I will bring it to Masahiro's attention.

Jacal
Tex,

I should actually report this as an issue on GitHub; I will do this as soon as I catch some dedicated free time and will to do it properly. It is not an important problem, but as far as I know it really degrades the performance on Windows.

Mart

tex
That would be great

I don't do anything on GitHub---don't have the savvy to chase down these problems like you and Odud.  I'll still pass it on to Masahiro, though.

Thanks a lot again for being a strong forum member, btw.  I really appreciate it, considering my long absences here.  Should be getting back to "normal"  soon, although I've got an upcoming trip that will make me scarce for several weeks in June.

ktgw0316
Thanks for make me remind it.

Thanks for make me remind it. I'll look into this as soon as possible.

Masahiro

Jacal
Thank you both,

take your time, have a fine day!

Mart

Photonoxx
Is the right way to do to

Is the right way to do to report issues/enhancement suggestion on Git Hub or it is preferable to do in an other way ? (I already do some)

Jacal
If i remember correctly,

Masahiro once said, he would prefer reports on GitHub, but since almost everybody uses this forum, he also checks things here.

Greetings,

Mart

Photonoxx
Thanks Jacal, so I would

Thanks Jacal, so I would continue to report directly on Git Hub if any.

Jacal
In some cases, I think,

it can be useful to discuss things here first, to get confirmations and opinions. Then you can make a link to your forum thread on GitHub.

Photonoxx
Yes, it's sure

Yes, it's sure

ktgw0316
I found the cause and will

I found the cause and will fix this issue in v4.1.1.

Here is an explanation:

1. On Windows, LZ reads maximum heap limit from the registry entry, and sets it as a -Xmx value.
2. LZ gets maxMemory value from JVM. Usually this value is about 11% smaller than the -Xmx value (1).
3. LZ sets the maxMemory value (2) as a maximum value for the Memory Limit slider. <- Bug!!
4. LZ backups your slider value in the registry entry.

Instead of using maxMemory(), I replaced the logic for the step 2 like this:

• The maximum value for the slider is one half of total memory on your PC.
• If your JVM is 32bit, the maximum value will never be greater than 2048MiB, even if the total memory is greater than 4096MiB
• The maximum value will be 512MiB if the total memory was too small (< 1024MiB).

This is the same logic that has been used in Linux version of LZ.

Hope this works.

Masahiro

Jacal
Great, Masahiro,

I also hope this works; and I hope you didn't spend the whole weekend coding.

Greetings,

Mart

Jacal
Looks to be fixed!

Fixed in LZ 4.1.1: Windows - Maximum value of Memory Limit slider in Preference shrinks over time

Here is the changelog and here the code.

Since I have been bothering you with this issue for over a year, I will keep an eye on it and test it on more than one computer soon, but it seems to work perfectly for now.

- No more "shrinking" of maximum memory limit means no more gradual degradation of performance.

- Windows version can now use more (half) of installed memory. According to my silly home-made tests (huge tool stacks, many regions and noise reductions) the speed gain might be something like 4-5 % or even more with extremely heavy tool stacks. LZ seems to be now as fast as Linux version on the same computer.

All in all, this might be quite a noticeable improvement of Windows version.

Thank you one more time, Masahiro!

Regards,

Mart