A
A
Antonzm2016-05-19 17:50:05
Java
Antonzm, 2016-05-19 17:50:05

How to deal with memory in java?

So, I decided to play around with neural networks, for this I chose the FANN library, made a small network, trained it, everything seems to be fine, well, I decided what little things I will do right away with a network that will recognize Linux Torvald)) (in the pictures 240X320) I did everything , what you need and moved on to creating the network itself and training it, I create:

layerList.add(Layer.create(76800, ActivationFunction.FANN_SIGMOID_SYMMETRIC, 0.01f));
        layerList.add(Layer.create(153600, ActivationFunction.FANN_SIGMOID_SYMMETRIC, 0.01f));
        layerList.add(Layer.create(153600, ActivationFunction.FANN_SIGMOID_SYMMETRIC, 0.01f));
        layerList.add(Layer.create(153600, ActivationFunction.FANN_SIGMOID_SYMMETRIC, 0.01f));
        layerList.add(Layer.create(1, ActivationFunction.FANN_SIGMOID_SYMMETRIC, 0.01f));
And what do you think happened? Correctly ! jvm ran out of memory.
So I have two questions:
1. How to allocate more RAM to jvm (I have 16gb on my computer)
2. Are there ways to work with memory more economically?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rou1997, 2016-05-19
@Antonzm

1. How to allocate jvm more RAM (I have 16gb on my computer)

With the xms and xmx command line options when you call java.exe.
Radically: abandon Java, I'm not a data scientist, but I have a person who does, and he does not use Java, and I do not see much advantages in it for neural networks.

D
Dmitry Alexandrov, 2016-05-20
@jamakasi666

2. Are there ways to work with memory more economically?

- As advised to abandon Java.
- Throw more RAM
- Optimize the code (do not shit code)
- Clusters?
- Transfer part of the logic to native
- Transfer data to the database?
- Rewrite a more optimized lib?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question