Shop OBEX P1 Docs P2 Docs Learn Events
running out of memory — Parallax Forums

running out of memory

MrlaserMrlaser Posts: 13
edited 2005-09-08 11:20 in General Discussion
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!

Comments

  • Jon KeinathJon Keinath Posts: 146
    edited 2005-09-07 01:46
    Are you able to post your code, we will be able to better assist you if we can look at it.

    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
  • MrlaserMrlaser Posts: 13
    edited 2005-09-07 11:25
    OK, here is the code (it may be a little rough, but hopefully I have put enough comments).

    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!
  • MrlaserMrlaser Posts: 13
    edited 2005-09-07 22:24
    I believe I have identified the source of my problem. In my main loop, I call a method defined in MyLib.CommandLibrary, which has an internally defined character array. I now need to fix that. I will make a new post when I have solved my problem.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lasers will rule the World!
  • MrlaserMrlaser Posts: 13
    edited 2005-09-08 11:20
    Well, I fixed my problem... it was the definition/creation of a variable in a method that was called during the loop.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lasers will rule the World!
Sign In or Register to comment.