This site requires JavaScript, please enable it in your browser!
Greenfoot back
Kartoffelbrot
Kartoffelbrot wrote ...

2013/11/17

More RAM for Greenfoot

Kartoffelbrot Kartoffelbrot

2013/11/17

#
mjrb4 wrote...
Kartoffelbrot wrote... It isn't necessary for the most scenarios, but a way to regulate the RAM, that is used by greenfoot would be very nice, so that you can handle bigger programs, too. --- This is already possible - just edit the bluej.vm.args property in greenfoot.defs to contain your chosen Xms and Xmx values.
Hello to all, I need to give my Greenfoot more RAM for a project, otherwise it's very laggy. I followed the assignment of mjrb4, but: What are Xms and Xmx? I've found this line: bluej.vm.args=-Xincgc -Dawt.useSystemAAFontSettings=on What should I change here? Are the changes saved in a jarfile, too?
Kartoffelbrot Kartoffelbrot

2013/11/18

#
No one can answer me? What's going on there danpost :D ?
GreenHouse GreenHouse

2013/11/18

#
-Xincgc wrote...
Enable the incremental garbage collector. The incremental garbage collector, which is off by default, will eliminate occasional garbage-collection pauses during program execution. However, it can lead to a roughly 10% decrease in overall GC performance.
-Xmsn wrote...
Specify the initial size, in bytes, of the memory allocation pool. This value must be a multiple of 1024 greater than 1MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 2MB.
-Xmxn wrote...
Specify the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes.
Kartoffelbrot Kartoffelbrot

2013/11/18

#
bluej.vm.args=-Xincgc -Dawt.useSystemAAFontSettings=on -Xms = 1024 -Xmx = 1024mkkkkkkkkkkkkkkkkkkkkkkkk (2048) Should it be like this ? Thank you!
GreenHouse GreenHouse

2013/11/18

#
Use -Xmx2018m to increase the maximum size to 2GB.
Kartoffelbrot Kartoffelbrot

2013/11/19

#
Oh, I see, what I've done wrong. Thanks, but shouldn't it be -Xmx2048m (2 * 1024) ? And are these changes saved in my jarfile?
davmac davmac

2013/11/19

#
Yes it should be -Xmx2048m. No it won't be saved in the jarfile when you export. This is a Java parameter, and there's no way to store it in the jar file and have Java honour it.
Kartoffelbrot Kartoffelbrot

2013/11/20

#
davmac wrote...
and have Java honour it.
What do you mean with this? My english isn't well enough. Has anyone suggestions to make my game less laggy?
GreenHouse GreenHouse

2013/11/20

#
Better coding = less laggy :D
Kartoffelbrot Kartoffelbrot

2013/11/20

#
Wow, I didn't thought about that :D I know, that I am less experieneced like you all, but I am learning java through school and myself, and in school we don't program much. the last time we did was in may and we will continue in february. And what we learned there was mainly syntax and objective orientation. It's the most important, but it becomes to less, if you want to stay on programming...
MatheMagician MatheMagician

2013/11/20

#
What is giving the lag? You probably should post the project, so we can give better feedback. There are a couple ways to speed things up. The general rule of thumb is "if you can bypass the normal greenfoot methods, then do." If you are drawing a lot of stuff, you can use get the GreenfootImage's bufferedimage (getAwtImage()), and use its methods (they are much faster). If you have a lot of actors, you could try replacing them with arrays/lists/simpler objects, etc, which take up less space.
Kartoffelbrot Kartoffelbrot

2013/11/20

#
I wrote...
I know, that I am less experieneced like you all
Sorry, I meant: I know, that I am less experieneced THAN you all @MatheMagician: Thanks, but I don't want to upload the project because it should be a present for my friends to christmas. They all know this website caused by my projects, that I've made so far, so the chance exists, that they will see it. I hope, that they don't read this °~° .
GreenHouse GreenHouse

2013/11/20

#
Some things that may speed up your scenario;
  • image caching
  • worker threads
  • .getAwtImage()
  • code improvement
  • recursive not explicit
  • image as actor
  • actor as image
  • avoid wait, sleep, synchronized
  • do not use greenfoot
  • bla bla bla...
Kartoffelbrot Kartoffelbrot

2013/11/20

#
Thanks. I noticed, that the size of the actors influences the need of RAM, too.
You need to login to post a reply.