Shop OBEX P1 Docs P2 Docs Learn Events
Javelin Programming Guidelines and Memory deallocation — Parallax Forums

Javelin Programming Guidelines and Memory deallocation

AnkurAnkur Posts: 7
edited 2005-06-01 15:49 in General Discussion
I am kind of new to Javelin:

1) Whenever i compile my code with just a method in it, It gives me an error saying that the method does not denote a class method? What am i doing incorrectly?

2) For my other code i am kind of filling up the heap too fast. I know java has its own garbage collector but is there any way using which i can deallocate memory?

Please let me know-

Ankur

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-06-01 15:25
    The Javelin HAS NO GARBAGE collector!

    This means you should avoid using the keyword new for temporary storage.

    Only local scalar variables short, int, byte and char are freed upon

    return from a method. You can however use a heap if you must allocate

    and free large blocks of ram space\

    http://groups.yahoo.com/group/JavelinCode/files/Javelin%20Stamp%20IDE/lib/stamp/peripheral/memory/



    General layout of class

    package package_path;

    import required_files;

    public class myClass {

    · //constructor

    · public myClass(int parameters) {

    · }

    · //method

    · public int test(int arg) {

    ··· return 0;

    · }

    }

    You must save the file in package_path with name myClass.java

    Also do not use the static keyword unless there is no need for more than

    one instance.





    regards peter
    ·
  • AnkurAnkur Posts: 7
    edited 2005-06-01 15:38
    Thankyou Peter.
    I will give your class a try.
    Problem is that i am trying to fill up a StringBuffer by appending it, thus i am running out of heap and the program quits on me saying out of memory. This is the first time i am doing embedded programming in JAVA. Please let me know what will be the best solution.
    Other thing is if i dont include the keyword static for my methods i get an error saying it is not a class method even if i initialize it in main.
    Please let me know.

    Thanks.

    Ankur
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-06-01 15:49
    Post your code in case of errors.

    That way I and others can see what might be wrong.

    regards peter
Sign In or Register to comment.