This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 4 - Pages: 1 - Last Post: 12-Nov-2016 17:19 Last Post By: karlmistelberger Threads: [ Previous | Next ]
karlmistelberger

Posts: 732
Registered: 5-Dec-2013
Java Heap Space
Posted: 10-Jan-2015 10:04
 
  Click to reply to this thread Reply
Available heap space depends on the java version installed:
karl@erlangen:~> java -version
java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.8) (suse-24.17.1-x86_64)
OpenJDK 64-Bit Server VM (build 24.55-b03, mixed mode)
karl@erlangen:~> java -Xmx4000m -DuseDesktop=true -jar /usr/share/jalbum/JAlbum.jar
The above invocation works fine with 64 bit Java. Memory is allocated as needed up to the maximum declared by -Xmx4000m. There is no penalty for small albums when declaring a huge heap size, but for large albums build times are lower.
Nordschleife

Posts: 71
Registered: 18-Dec-2012
Re: Java Heap Space
Posted: 11-Jan-2015 17:48   in response to: karlmistelberger in response to: karlmistelberger
 
  Click to reply to this thread Reply
Thanks for the tip - this speeds up my large album a lot.
karlmistelberger

Posts: 732
Registered: 5-Dec-2013
Re: Java Heap Space
Posted: 25-Jun-2016 21:33   in response to: karlmistelberger in response to: karlmistelberger
 
  Click to reply to this thread Reply
Wondering about out of memory errors encountered by some users and reading about changing heap size with effects unsupported by own experience I had a closer look at the java virtual machine and found some facts which may be helpful to other users:

  • You may query the maximum heap size supported by your own machine:
    erlangen:~ # /usr/lib/jalbum/jre64/bin/java -XshowSettings:vm
    VM settings:
        Max. Heap Size (Estimated): 3.41G
        Ergonomics Machine Class: server
        Using VM: Java HotSpot(TM) 64-Bit Server VM
     
    Usage: java [-options] class [args...]
               (to execute a class)
       or  java [-options] -jar jarfile [args...]
               (to execute a jar file)
    where options include:
        -d32          use a 32-bit data model if available
        -d64          use a 64-bit data model if available
        -server       to select the "server" VM
                      The default VM is server,
                      because you are running on a server-class machine.
    ... 
    See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
    erlangen:~ # 
    
    Obviously my machine has a Max. Heap Size of 3.41GB.

  • checking the parent process tree:
    erlangen:~ # pstree 20744
    java─┬─ffmpeg───7*[{ffmpeg}]
         └─69*[{java}]
    erlangen:~ 
    
    Java does not care about processor numbers. It spawns 69(!) children of its own and one instance of ffmpeg which spawns another 7 children of ffmpeg.

  • Making a large album (33,761 images and videos, 80 GB altogether) with jAlbum 13.2.4 consumes all of the memory available without impairing the responsiveness of the GUI:
    erlangen:~ # free -h
                 total       used       free     shared    buffers     cached
    Mem:           15G        15G        86M       568M       181M       9.5G
    -/+ buffers/cache:       5.6G       9.7G
    Swap:         7.5G       1.0M       7.5G
    erlangen:~ # 
    

  • omitting the (default) -Xmx1200m value from the command line causes the virtual machine to use 3.41GB and does decrease build times moderately: from 2:29h to 2:24h for a build from scratch and from 2:16m to 2:11m for a build of all skin files only.

Conclusions

While increasing heap size is necessary with the 32 bit version of Java, it does not matter much when using the 64 bit version. You may safely delete the parameter from the command line and will not experience any inconvenience.

More about jvm
karlmistelberger

Posts: 732
Registered: 5-Dec-2013
Re: Java Heap Space
Posted: 05-Jul-2016 07:45   in response to: karlmistelberger in response to: karlmistelberger
 
  Click to reply to this thread Reply
Checked Virtual machine parameters on a very old 32 bit machine:
hofkirchen:~ # java -XshowSettings:vm
VM settings:
    Max. Heap Size (Estimated): 910.25M
    Ergonomics Machine Class: server
    Using VM: Java HotSpot(TM) Server VM
 
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32          use a 32-bit data model if available
    -d64          use a 64-bit data model if available
    -client       to select the "client" VM
    -server       to select the "server" VM
    -minimal      to select the "minimal" VM
                  The default VM is server,
                  because you are running on a server-class machine.
Both the 64 bit and the 32 bit of Oracle Java now use -server as a default, so specifying -Xmx on the command line has become obsolete in most cases as a very reasonable heap size is selected by default. Users building large albums should check whether -server is default on their machines and if not specify it on the command line:
java -server -jar /usr/share/jalbum/JAlbum.jar 
karlmistelberger

Posts: 732
Registered: 5-Dec-2013
Transcoding the camera originals
Posted: 12-Nov-2016 17:19   in response to: karlmistelberger in response to: karlmistelberger
 
  Click to reply to this thread Reply
Attachment jalbum1.png (155,5 KB)
Viewings jAlbums Image directory with the Smart TV via a DLNA Media Server is an interesting option. But most Smart TV do not support older video formats, such as .avi and .mov. Transcoding these videos with ffmpeg is painless and can be done issuing a single command:
 for i in $(find Bilder/ -name *.mov) ; do ffmpeg -i $i -pix_fmt yuv420p ${i%*mov}mp4; done
Transcoding jAlbum's input movies requires rebuilding videos and skin files. jAlbum was invoked as /usr/lib/jalbum/jre64/bin/java -jar /usr/lib/jalbum/JAlbum.jar and claimed some 3.5 GB of heap space (see screenshot) and another 20 GB of OS cache. Processing 680 video clips (12.1 GB, equivalent to several DVDs) took some 29 minutes to complete which compares favorably with total playtime of several hours.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums