running out of memory
Mrlaser
Posts: 13
OK, I am running into a·problem due I believe to the lack of garbage collection.
I have a Javelin controlling an instrument, and I have a RS232 link between the Javelin and a PC. The communication works fine, I get the PC to control some of the functions of the Javelin.
Now, I am trying to add a small LCD display on my instrument with the Javelin, so I can display some data from my instrument on that LCD display.
The LCD display is a serial LCD from Scott Edwards Electronics (BPI-216). I have used them with great success in many applications with Basic Stamps. Now I am basically upgrading with Javelin.
In my main program, I have a continuous loop and I send info (updated data)·to the PC every second. I want to also display some of that data on the LCD at the same time.
And that is where I am running into a problem of memory shortage (this could be my age, but this is not MY memory...). I know there is an issue when using strings, so I am using chatacter arrays insteads. I am basically sending the same data (the same character array) first to the PC, and then to the LCD. Both are sent using a Uart VP, with the same settings except the CPU.pin. The link to the PC goes through a 232 line adapter, whereas the pin to the LCD goes directly to the LCD, but the program does not know the difference.
So, when I had only communication to the PC, the program runs fine. I even monitored the memory usage with debug, and it is stable.
But when I add the command to send the exact same information to the LCD, the program runs out of memory very rapidly. With the debug, I can see the amount of heap increasing rapidly!!
Does anyone has any idea of what I am doing wrong, or is there a way to fix my (or rather the Javelin) memory problem?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Lasers will rule the World!
I have a Javelin controlling an instrument, and I have a RS232 link between the Javelin and a PC. The communication works fine, I get the PC to control some of the functions of the Javelin.
Now, I am trying to add a small LCD display on my instrument with the Javelin, so I can display some data from my instrument on that LCD display.
The LCD display is a serial LCD from Scott Edwards Electronics (BPI-216). I have used them with great success in many applications with Basic Stamps. Now I am basically upgrading with Javelin.
In my main program, I have a continuous loop and I send info (updated data)·to the PC every second. I want to also display some of that data on the LCD at the same time.
And that is where I am running into a problem of memory shortage (this could be my age, but this is not MY memory...). I know there is an issue when using strings, so I am using chatacter arrays insteads. I am basically sending the same data (the same character array) first to the PC, and then to the LCD. Both are sent using a Uart VP, with the same settings except the CPU.pin. The link to the PC goes through a 232 line adapter, whereas the pin to the LCD goes directly to the LCD, but the program does not know the difference.
So, when I had only communication to the PC, the program runs fine. I even monitored the memory usage with debug, and it is stable.
But when I add the command to send the exact same information to the LCD, the program runs out of memory very rapidly. With the debug, I can see the amount of heap increasing rapidly!!
Does anyone has any idea of what I am doing wrong, or is there a way to fix my (or rather the Javelin) memory problem?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Lasers will rule the World!
Comments
I have a Program that basically does the same thing , sends messages every second to both a PC(mostly for debuging) and a LCD (Matrix Orbital). Currently it has been running for 2 weeks with out a problem.
When I have a complex (like "Sum = " + variable ) string to send I use the Stringbuffer method (details on page 154 in the Javelin Stamp Manual), maybe that will help.
I hope this helps.
-Jon Keinath
The file KLScomDebugTest.java goes into a folder I created called MyProjects in the Javelin Projects folder, and the CommandLibrary.java file goes into a sub-folder called MyLib (in MyProjects folder).
I had tried using StringBuffer, but I will try again.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Lasers will rule the World!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Lasers will rule the World!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Lasers will rule the World!