We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello everyone
I have a problem with my application for processing. This increase the use of ram the computer until a few minutes after the program is blocked.
I think the system saves unnecessary data .
Is there any function or library with ability to reset the program and keep it only important data?
A greeting and Thanks so much
Answers
Hello,
I do not think that kind of library exist. Because how an algorithm could decided what is important or not in your code ? It's possible to change the maximum available memory in the processing's preferences. And you could optimise your code :)
I know that the memory can be Increased. But at the rate That grows in 20-30 minutes excede 2GB and not Consider It Appropriate to Overcome Those levels.
My thought was to reset the program every 15 minutes. And make a external saved, the values of the variables. Furthermore, this would be very useful saved to avoid loss of information to anomalies.
I am new to programming and optimizing code seems complicated. I do not understand that exists both memory consumption.
A greeting and thanks for the reply
The problem is that your message is quite generic...
Some programs use very little memory, others can eat all available memory quite quickly.
Finding where the memory is consumed can be delicate and in all cases, need the source to be examined. Sometime it is the normal behavior of the code (which can be improved to remove unnecessary data), sometime it is a memory leak (memory which should have been freed but isn't).
There are some tools helping in the diagnostic, but they suppose some good programming knowledge to use them effectively...
Now, indeed, you can save images or data to disk, free it, reload it later if you need it back. Processing can do that...
About the "automatic" part: no, Processing won't magically save "important" data and reset it. You have to find yourself what is important and takes lot of place, and save it yourself.
I have found parts of the program that is saturated. The minim library consumes about 30mb, by wave of data, for audio playback.
And the speech recognizer stt consumes about 0.5 mb / s of memory.
It would be very good for my program have a database with the values of the variables to turn to. So no data would be lost when you close the program.
The problem is that I have no idea how I can do it.
A greeting and thanks for the reply
These are the only values that range and I want to keep. How I can make a database to store and collect?
A greeting and thanks for the reply
well, these lines can't really be the problem because they use very little space
but you can use saveStrings() and loadStrings()
it might help to post your code so we can have a look where the problem is, e.g. some people load images in draw() which is wrong
you can increase memory in the preferences as been said
there are ways to invoke a process of garbage collecting for the memory
see
http://forum.processing.org/one/topic/remove-a-loaded-pimage-or-an-array-etc#25080000001535033.html
Thank so much Chrisir
I was unaware of these functions for save and read data, I'm introducing them to my program and I will make backup of the data, for if dropped the program.
A pity that there is no saveInt (), I'll have to think about how to move from Int to string and back to int. salveBytes () I fall short.
The complete code of the program is very extensive (15,000 characters) I'm going to try to hang the parts that I think can cause problems.
Regards and thank you very much, has been very useful to me your answer.
I do not upload images in the draw(), but if sounds. Will that be the problem?
sonido = minim.loadFile("port disable" + ".mp3");
as I can fix this?
Make sonido a global var and load the file in setup(), pls. Thx.
The sonido problem I've solved
As easy as putting
sonido.close();
Beforeminim.loadFile
Now it remains to solve the problem with the voice recognizer.
This simple program consumes 0.5 mb / s of RAM.
Can you think of any solution?
Good Morning
This code does not work well.
I think the problem lies somewhere unseen object minim rate, generated by, the library stt.
I don't know stt
stt.enableAutoRecord();
Why?
Why not disable?
It's better that way. The program is attentive and the microphone exceeds a certain value activates the voice recognizer.
If you remove it you have to use
stt.begin () and stt.end ();
The ram memory problem is not fixed in any of the forms.
there is still a lot of stuff that shouldn't be in draw() or in reconoicer() which gets called by draw().
import ddf.minim.*; you have that line before setup, so delete line 20.
STT stt2; before setup() pls
this in setup()
and this stt2.enableAutoRecord(); : disable
remember that draw() (and therefore reconoicer() ) gets called 60 times per second and setup() runs only once. So all preparations must be in setup
Hi Chrisir
I spoke with Florian Schulz, he stt developer, and he has informed me that it is a problem of the library that is under investigation.
I think the fault is due to misuse of the minim library by the library stt. I think that makes a call to a variable type AudioPlayer and this is never closed. The java object reference remains and the garbage collector can not do anything.
I have informed the developer and see if he has time and can fix this.
i see!