IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

2D Java Discussion :

Union d'Area, le bug.


Sujet :

2D Java

  1. #1
    Membre éprouvé

    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    1 448
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Juillet 2006
    Messages : 1 448
    Par défaut Union d'Area, le bug.
    Bonjour, je fais dans un programme plusieurs fois des union d'Area dont les formes représentent des lignes de texte.
    Pour l'une d'elles (la plus courte paradoxalement), lors de l'add (union) la machine s'emballe et j'obtiens au final un joli plantage mémoire "[...] Java Heap memory".

    Ce bug est-il connu?
    Y a t'il une jre où il n'apparaisse pas?
    Y a t'il un workarround?

    Merci de bien vouloir m'aider, je suis dans l'impasse.

    PS: Il n'y a pas de problème de mémoire à la source, mon diagnostique est malheureusement bien correct.

  2. #2
    Expert confirmé
    Avatar de sinok
    Profil pro
    Inscrit en
    Août 2004
    Messages
    8 765
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Par défaut
    Version de la jre utilisée, paramètre de lancement (genre -Xmx dans ton cas qui définit la taille de la heap)... Il nous manque un peu d'infos pour t'aider

  3. #3
    Membre éprouvé

    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    1 448
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Juillet 2006
    Messages : 1 448
    Par défaut
    F:\eclipse3.2\eclipse\eclipse.exe -vm "F:\Program Files\Java\jre1.5.0_06\bin\javaw.exe" -vmargs -Xms256m -Xmx1024m

    Mais j'utilisais la .08 avant (j'ai pas reboot depuis l'update cela dit).

  4. #4
    Gfx
    Gfx est déconnecté
    Expert confirmé
    Avatar de Gfx
    Inscrit en
    Mai 2005
    Messages
    1 770
    Détails du profil
    Informations personnelles :
    Âge : 43

    Informations forums :
    Inscription : Mai 2005
    Messages : 1 770
    Par défaut
    T'es sûr que le bug vient de la JVM ?

  5. #5
    Membre éprouvé

    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    1 448
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Juillet 2006
    Messages : 1 448
    Par défaut
    Aussi sûr que l'ont peut l'être quand on surveille très spécifiquement un traitement (Area.add).

  6. #6
    Gfx
    Gfx est déconnecté
    Expert confirmé
    Avatar de Gfx
    Inscrit en
    Mai 2005
    Messages
    1 770
    Détails du profil
    Informations personnelles :
    Âge : 43

    Informations forums :
    Inscription : Mai 2005
    Messages : 1 770
    Par défaut
    Peux-tu nous montrer ton code et l'exception complète ?

  7. #7
    Membre éprouvé

    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    1 448
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Juillet 2006
    Messages : 1 448
    Par défaut
    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
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
     
    package assAdapterV02;
     
    import java.awt.*;
    import java.awt.font.FontRenderContext;
    import java.awt.font.GlyphVector;
    import java.awt.font.LineMetrics;
    import java.awt.geom.AffineTransform;
    import java.awt.geom.Area;
    import java.awt.image.BufferedImage;
    import java.awt.image.Raster;
     
    public class Testgu {
     
    	protected static void setQualityGraphics(Graphics2D gr2D) {
    		gr2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
    				RenderingHints.VALUE_ANTIALIAS_ON);
    		gr2D.setRenderingHint(RenderingHints.KEY_RENDERING,
    				RenderingHints.VALUE_RENDER_QUALITY);
    		gr2D.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
    				RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
    		gr2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
    				RenderingHints.VALUE_INTERPOLATION_BICUBIC);
    	}
     
    	/**
             * @param args
             */
    	public static void main(String[] args) {
    		String font = "Electrik";
    		int fontSize = 24;
    		int fontType = Font.BOLD;
    		int width = 640;
    		int height = 60;
    		int border = 2;
     
    		Font myFont = new Font(font, fontType, fontSize);
    		String myString = "My Sweet Home";
     
    		BufferedImage tmpBIm = new BufferedImage(width, height,
    				BufferedImage.TYPE_INT_ARGB);
    		Graphics2D tmpGraphics2D = tmpBIm.createGraphics();
    		setQualityGraphics(tmpGraphics2D);
     
    		FontRenderContext tmpFRC = tmpGraphics2D.getFontRenderContext();
     
    		int flag = Font.LAYOUT_LEFT_TO_RIGHT | Font.LAYOUT_NO_START_CONTEXT
    				| Font.LAYOUT_NO_LIMIT_CONTEXT;
     
    		GlyphVector glv = myFont.layoutGlyphVector(tmpFRC, myString
    				.toCharArray(), 0, myString.length(), flag);
    		LineMetrics lineMet = myFont.getLineMetrics(myString, tmpFRC);
     
    		float textMaxHeight = lineMet.getAscent() + lineMet.getDescent();
     
    		AffineTransform tmpAFT = new AffineTransform();
     
    		double tx, ty;
     
    		tx = (width - glv.getVisualBounds().getWidth()) / 2.0;
    		ty = (height - textMaxHeight) / 2.0 + lineMet.getAscent();
    		tmpAFT.setToTranslation(tx, ty);
     
    		// Définition des shapes
    		Shape shapeIntern = tmpAFT.createTransformedShape(glv.getOutline());
     
    		Stroke tmpStroke;
    		tmpStroke = new BasicStroke(border, BasicStroke.CAP_ROUND,
    				BasicStroke.JOIN_ROUND);
     
    		Shape shapeExtern = tmpStroke.createStrokedShape(shapeIntern);
     
    		Area startShape = new Area(shapeIntern);
    		System.out.println("xxx");
    		Area tmpJK;
    		tmpJK = new Area(shapeExtern);
    		System.out.println("yyy");
    		startShape.add(tmpJK);
    		System.out.println("zzz");
     
    	}
    }
    xxx
    yyy
    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    Voici, ci-joint la police utilisée (compressée en zip).

  8. #8
    Gfx
    Gfx est déconnecté
    Expert confirmé
    Avatar de Gfx
    Inscrit en
    Mai 2005
    Messages
    1 770
    Détails du profil
    Informations personnelles :
    Âge : 43

    Informations forums :
    Inscription : Mai 2005
    Messages : 1 770
    Par défaut
    Je ne peux pas reproduire l'erreur.

  9. #9
    Membre éprouvé

    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    1 448
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Juillet 2006
    Messages : 1 448
    Par défaut
    Alors c'est parfait, quelle jre et avec quels paramètres utilises-tu ?

  10. #10
    Gfx
    Gfx est déconnecté
    Expert confirmé
    Avatar de Gfx
    Inscrit en
    Mai 2005
    Messages
    1 770
    Détails du profil
    Informations personnelles :
    Âge : 43

    Informations forums :
    Inscription : Mai 2005
    Messages : 1 770
    Par défaut
    J'ai testé avec un JRE 1.5.0_06 et un JRE 1.6 b88, tous les deux sous Mac OS X.

  11. #11
    Membre éprouvé

    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    1 448
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Juillet 2006
    Messages : 1 448
    Par défaut
    Citation Envoyé par Gfx
    J'ai testé avec un JRE 1.5.0_06 et un JRE 1.6 b88, tous les deux sous Mac OS X.
    Moi j'ai windows xp.

Discussions similaires

  1. Créer une vue pour trier une requete UNION ?
    Par Etienne Bar dans le forum SQL
    Réponses: 3
    Dernier message: 03/01/2003, 20h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo