Bonjour à tous,

J'ai réalisé un applet qui me permet d'afficher une succession d'image qu'un script php envoi.
Tout marche très bien , cependant la mémoire utilisé par java.exe sur mon poste m'inquiète un peu.
Dès que l'applet se lance la mémoire utilisée grimpe jusqu'à atteindre ~290Mo limite où tout se stabilise.
Est ce normal ? N'étant pas du tout développeur JAVA de formation je n'ai pas vraiment d'expérience sur la gestion mémoire.

Ci dessous les principales méthodes de mon applet gérant la récupération et l'affichage des images :

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
public void run()
{
	while(threadPlayer!=null && this.stopLecture == false)
	{
 
		if(this.imageloaded)
		{
			this.imageloaded    = false;
			this.getUrlImage();
			ImageIcon img       = new ImageIcon(UrlImage);
 
			this.imgFromUrl = img.getImage();
			this.repaint();
		}
	}
}
 
public void paint(Graphics g)
{
	int xStart = 0;
	int yStart = 0;
 
	if(this.resolution==R320_240 && this.plan == 0)
	{
	  xStart  = 160;
	  yStart  = 120;
	}
 
	if(this.zoom==ZOOM_TO_640)
		g.drawImage(imgFromUrl, 0, 0, 640, 480, 0, 0, 320, 240, this);
	else
		g.drawImage(this.imgFromUrl, xStart, yStart, this);
 
	if(this.clearRect)
	{
		g.clearRect(0,0,640,480);
		this.clearRect = false;
	}
 
	g.dispose();
	this.imageloaded = true;
 
}
 
private void getUrlImage()
{
	try{
 
		StringBuilder sb = new StringBuilder();
		String listeCam;
		sb.append(this.numCams[0]);
		for(int i=1; i<this.mosaique; i++) {
			sb.append(",");
			sb.append(this.numCams[i]);
		}
		listeCam = sb.toString();
		this.UrlImage = new URL(this.host+"includes/modules/video/createImage.php?act=2&ticket="+this.ticket+"&cam="+listeCam);
	}
	catch(MalformedURLException e)
	{
		this.affichError("No connection : "+this.ticket);
	}
}