Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Memory Java进程物理内存不断增加_Memory_Javafx_Process - Fatal编程技术网

Memory Java进程物理内存不断增加

Memory Java进程物理内存不断增加,memory,javafx,process,Memory,Javafx,Process,我遇到了一个简单的画布 绘图应用程序显示物理量逐渐增加 随着时间的推移,内存使用率会不断提高,直到达到80%左右 并尝试保持进程内存使用率在 该数字(即运行“top”时的%MEM列,64位Linux框)。当然,到那时页面交换开始起作用了。我试图通过使用-Xmx10m-Xms10m甚至-XX:+UseG1GC来限制内存使用,但似乎没有什么不同。 顺便说一句,我甚至尝试了oracle jdk Javafx示例附带的StockLineChartApp示例,它也显示了物理内存使用量的增加。我正在使用jd

我遇到了一个简单的画布 绘图应用程序显示物理量逐渐增加 随着时间的推移,内存使用率会不断提高,直到达到80%左右 并尝试保持进程内存使用率在 该数字(即运行“top”时的%MEM列,64位Linux框)。当然,到那时页面交换开始起作用了。我试图通过使用-Xmx10m-Xms10m甚至-XX:+UseG1GC来限制内存使用,但似乎没有什么不同。 顺便说一句,我甚至尝试了oracle jdk Javafx示例附带的StockLineChartApp示例,它也显示了物理内存使用量的增加。我正在使用jdk1.8.0_102

关于这个问题的任何反馈都会非常有用。谢谢

//

package test8;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
import javafx.util.Duration;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.animation.Animation;

public class Test8 extends Application {

   GraphicsContext gc;
     double x;
     double y;

    @Override
    public void start(Stage primaryStage) {

      try {

        Group root = new Group();
        Scene s = new Scene(root, 600, 400, Color.BLACK);

        final Canvas canvas = new Canvas(500,300);
        gc = canvas.getGraphicsContext2D();

        root.getChildren().add(canvas);

        Pane pane = new Pane();
        pane.getChildren().add(root);

        Scene scene = new Scene(pane);

        primaryStage.setTitle("canvas test");
        primaryStage.setScene(scene);
        primaryStage.show();

     gc.beginPath();

     x = 0.0;
     y = 0.0;

   EventHandler onFinished = new EventHandler<ActionEvent>() {
         public void handle(ActionEvent t) {

           y = (y<canvas.getHeight()) ? (y + 10.0)   : 0.0;
           x = (x<canvas.getWidth())  ? (x + 5.0)    : 0.0;

           gc.lineTo(x,y);
           gc.stroke();
           if (x==0.0) gc.beginPath();

     }
      };


      final Timeline timeline = new Timeline();
      timeline.setCycleCount(Animation.INDEFINITE);
      timeline.setAutoReverse(true);
      timeline.getKeyFrames().add(new KeyFrame(Duration.millis(40), onFinished));
      timeline.play();

      } catch (Exception e) {
     System.out.println("Application start Exception");
      } finally {
      }

    }

    public static void main(String[] args) {
        launch(args);
    }

}
//
包装测试8;
导入javafx.application.application;
导入javafx.event.ActionEvent;
导入javafx.event.EventHandler;
导入javafx.scene.Group;
导入javafx.scene.scene;
导入javafx.scene.control.Button;
导入javafx.scene.layout.Pane;
导入javafx.stage.stage;
导入javafx.scene.canvas.canvas;
导入javafx.scene.canvas.GraphicsContext;
导入javafx.scene.paint.Color;
导入javafx.util.Duration;
导入javafx.animation.KeyFrame;
导入javafx.animation.KeyValue;
导入javafx.animation.Timeline;
导入javafx.animation.animation;
公共类Test8扩展了应用程序{
GraphicsContext gc;
双x;
双y;
@凌驾
公共无效开始(阶段primaryStage){
试一试{
组根=新组();
场景s=新场景(根,600,400,颜色.黑色);
最终画布=新画布(500300);
gc=canvas.getGraphicsContext2D();
root.getChildren().add(画布);
窗格=新窗格();
pane.getChildren().add(根目录);
场景=新场景(窗格);
初级阶段。设置标题(“画布测试”);
初级阶段。场景(场景);
primaryStage.show();
gc.beginPath();
x=0.0;
y=0.0;
EventHandler onFinished=新的EventHandler(){
公共无效句柄(ActionEvent t){

y=(这解决了linux 64位的问题…..基本上使用-Dprism.order=sw,它似乎包含不断增加的系统内存使用量。另请参阅(可能重复的问题)