Bonjour que signifie cette erreur ?
Exception in "Thread-6" java.lang.OutOfMemoryError: Java heap space
avec la variante "Thread-4" au lieu de "Thread-6" parfois.
je pense que le probleme de memoire vient du fait que je cree plusieurs images et que certaines restent en memoire .

L'erreur semble venir de cette methode, peut etre y a t il une erreur frappante dans ce code ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//Get pixels of the 3D image
    public int[] Get3DPixels(int x1,int x2,int y1,int y2,int slice)
    {
    	 System.gc();
    	//boo_3DDrag=true; 
    	int_pic=slice;
    	 int_rectInitX =x1; 
         int_rectInitY =y1;
         int_3DWidthInit =Math.abs(x1-x2); 
         int_3DHeightInit=Math.abs(y1-y2);
    	//Retrieve coordinates information and width and height information
    	
    	//Jbutton3D Action performed
    	// if(Math.min(int_3DWidthInit,int_3DHeightInit)*int_3DWidthInit*int_3DHeightInit<15000000)    //Verify that 3D array is not too big
        // { 
    		int[] pixels=null;
         	System.out.println("ThreeD:Get3DPixels() x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2);
         	
         	//   boo_3DDrag=false;         
             int_3DWidth = 20;//int_3DWidthInit;
             int_3DHeight =40;// int_3DHeightInit;
            
             if(!boo_3DStart) //Rotate the 3D cube on x and z axis
             {
            	 System.out.println("no rotation rotationx="+rotatex+" rotationz="+rotatez);
             int_xRotate=0;
             int_zRotate=0;
             }
             else
        	 {
            	 System.out.println("rotation ok rotationx="+rotatex+" rotationz="+rotatez);
            	 int_xRotate=rotatex;//Rotate the object 
            	  int_zRotate=rotatez;
        	 }
             //jPanel3D.setVisible(true);       
             //jButton3D.setVisible(false);         
             //jLabel3DRect.setVisible(false);          
             jSlider3DDepth.setMinimum(1);     
             jSlider3DDepth.setMaximum(Math.min(int_3DWidthInit,int_3DHeightInit));        
             int_3DDepth = jSlider3DDepth.getMaximum()/3;        
             jSlider3DDepth.setValue(int_3DDepth);                     
             jSlider3DDist.setMaximum(jSlider3DDepth.getMaximum()); 
             this.load();
             var.dist=-1000;      
             var.pic = new Picture(int_3DWidthInit, int_3DHeightInit);        
             var.cube = new Cube();   
             var.vol = new Volume(int_3DWidthInit, int_3DHeightInit, int_3DDepth);          
             var.pic.setVol(var.vol);
             var.tr = new Transform(int_3DWidthInit, int_3DHeightInit);    
             var.tr.setView(Math.toRadians(int_xRotate),Math.toRadians(int_zRotate));
             //toDisplay = var.pic.newDisplayMode(boo_3DDrag); 
            pixels=var.pic.GetPixels(boo_3DDrag);
             //   jSlider3DDist.setMinimum(var.dist);         
           //  jSlider3DDist.setValue(var.dist);
           //  jLabel3D.setPreferredSize(new java.awt.Dimension(int_3DWidthInit, int_3DHeightInit));            
           //  jLabel3D.setBounds((widthInVoxels-int_3DWidthInit)/2, (heightInVoxels-int_3DHeightInit)/2, int_3DWidthInit, int_3DHeightInit);         
           //  jLabel3D.setIcon(new ImageIcon(toDisplay));
           //  jLabel3D.repaint();
           //  jLabel3D.setVisible(true);         
        //     boo_3DStart=true;
           //  this.repaint();
         //}
             System.out.println("ThreeD:Get3DPixels Return Image");
    			//return  toDisplay;
            
         
    	
    	 return pixels;
    }

Pour resoudre ce type d'erreur j'ai mis des System.gc();
un peu partout dans le code de mon serveur.
Que pensez vous de cette initiative ? Quelles sont les autres possibilites ?