Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2535 connectés 

  FORUM HardWare.fr
  Programmation
  C

  probleme fuite de memoire

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

probleme fuite de memoire

n°2186561
icemake
Posté le 19-04-2013 à 09:32:11  profilanswer
 

bonjour,
je vous montre mon programme vous pouvez me dire si vous trouvé un endroit ou il peut y avoir des fuite de mémoire car j'en ai mais je sais pas pourquoi
 
 
PROBLEME RESOLU


Message édité par icemake le 19-04-2013 à 11:52:15
mood
Publicité
Posté le 19-04-2013 à 09:32:11  profilanswer
 

n°2186580
theshockwa​ve
I work at a firm named Koslow
Posté le 19-04-2013 à 10:50:07  profilanswer
 

Ton indentation est en vrac, ton code est un pavé illisible.
Commence par découper ton programme en bloc sémantiques que tu mets dans des fonctions séparées, et peut-être que tu trouveras le problème tout seul en faisant ce brin de nettoyage.

 

Edit : Erf, j'ai loupé qu'il y avait quelques fonctions, c'est juste tellement dense que ca n'apparait pas (et le nommage de tes variables et fonctions n'aide pas énormément)


Message édité par theshockwave le 19-04-2013 à 10:51:38

---------------
last.fm
n°2186620
gilou
Modérateur
Modzilla
Posté le 19-04-2013 à 13:54:37  profilanswer
 

Comme je n'aime pas qu'on supprime un code posté ici, je le remet, mais juste un poil formaté, parce que ce qui était posté ici était complètement illisible.
Et si on pond du code illisible, on ne peut pas se relire, et donc on ne peut pas corriger correctement son code.

Code :
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "libbmp.h"   // permet de travailler sur des images au format .bmp
  4. //prototypes
  5. t_bmp bordure(t_bmp);
  6. t_bmp LPE(t_bmp);
  7. t_bmp dilatation(t_bmp, t_bmp);
  8. // declaration de variables
  9. char image[60],car;
  10. t_bmp bmp,bmp1,bmp2,bmp3;
  11. int a=0,b=0,c=0, i, k, savi, j, savj, l, largeur, longueur, longueur2,test,test1,test2,test3,nbrbille=0,current = 10;
  12. const int z=100;
  13. double bille;
  14. long repere;
  15. FILE *texte;
  16. int main(int argc, const char * argv[])
  17. {
  18.     while(1) {
  19.         sprintf(image, argv[2]);  //choix du nom de l'image
  20.         test = libbmp_load(image, &bmp);  //ouvre l'image au format .bmp
  21.         if(test) {
  22.             texte = fopen(argv[1],"at" ); //ouverture d'un fichier texte
  23.             fseek(texte, current, SEEK_SET);
  24.             car = fgetc(texte);
  25.             while(car != '\n') {
  26.                 if(ftell(texte)==0) {
  27.                     break;
  28.                 }
  29.                 current--;
  30.                 fseek(texte, current, SEEK_SET);
  31.                 car = fgetc (texte);
  32.             }
  33.             fgets(image, 60, texte);
  34.             fprintf(texte,"%s\n",image); //ecriture du nom de l'image dans le fichier texte
  35.             /******************elimination des billes en bordure *********************/
  36.             bmp = bordure(bmp);    //supprime les billes coupees par les bords de l'image
  37.             /*****************decoupage par LPE**************************************/
  38.             bmp = LPE(bmp);     //decolle les billes collees
  39.             /*******************traitement de l'image**************************************/
  40.             a=0;
  41.             b=0;
  42.             c=0;
  43.             for(i=0; i<bmp.width; i++) { //deplacement sur le pixel en largeur
  44.                 for(j=0; j<bmp.height; j++) { // deplacement sur les pixel en hauteur
  45.                     if(j<bmp.height-2 && j>2) { //supprime les trou pouvant etre present entre les billes
  46.                         if(bmp.data[j][i].moy==0
  47.                                 && (bmp.data[j-2][i].moy==255 || bmp.data[j-1][i].moy==255)
  48.                                 && (bmp.data[j+2][i].moy==255 || bmp.data[j+1][i].moy==255)
  49.                                 && bmp.data[j-1][i-1].moy==255
  50.                                 && bmp.data[j][i-1].moy==255
  51.                                 && bmp.data[j+1][i-1].moy==255
  52.                                 && (bmp.data[j+1][i+1].moy==255 || bmp.data[j+2][i+1].moy==255)) {
  53.                             bmp.data[j][i].moy=255;
  54.                         }
  55.                     }
  56.                 }
  57.             }
  58.             for(i=0; i<bmp.width; i++) { //deplacement sur le pixel en largeur
  59.                 for(j=0; j<bmp.height; j++) { // deplacement sur les pixel en hauteur
  60.                     a+=20; //labellisation des billes
  61.                     if(a>255) {
  62.                         a=0;
  63.                         b+=20;
  64.                     }
  65.                     if(b>255) {
  66.                         b=0;
  67.                         c+=20;
  68.                     }
  69.                     if(bmp.data[j][i].moy==255) { //recherche de pixel blanc
  70.                         longueur2=0; //initialisation des valeurs
  71.                         largeur=0;
  72.                         bille=0;
  73.                         savi=i;     //sauvegarde la position du point
  74.                         savj=j;
  75.                         do  { //double boucle pour compter la taille d'un bille et la supprimer de l'image
  76.                             do {
  77.                                 if(j<bmp.height-1 && j>0)
  78.                                     if(bmp.data[j][i+1].moy==255
  79.                                             && bmp.data[j+3][i+1].moy==255
  80.                                             && bmp.data[j+1][i+1].moy==255
  81.                                             && bmp.data[j-3][i+1].moy==255
  82.                                             && bmp.data[j-1][i+1].moy==255
  83.                                             && bmp.data[j-2][i+1].moy==255
  84.                                             && bmp.data[j+2][i+1].moy==255) {
  85.                                         savj=j;
  86.                                     }
  87.                                 longueur++;
  88.                                 bmp.data[j][i].moy=(a+b+c)/3;   //change la couleur du pixel
  89.                                 // bmp.data[j][i].r=a;
  90.                                 // bmp.data[j][i].b=b;
  91.                                 // bmp.data[j][i].g=c;
  92.                                 j++;
  93.                                 if(j==bmp.height) {
  94.                                     break;
  95.                                 }
  96.                             } while(bmp.data[j][i].moy==255);
  97.                             j=savj;
  98.                             i++;
  99.                             if(j>0) {
  100.                                 while(bmp.data[j-1][i].moy==255 && j>1) {
  101.                                     j--;
  102.                                     if(bmp.data[j-1][i].moy==0 && bmp.data[j-2][i].moy==255 && bmp.data[j-2][i-1].moy==((a+b+c)/3)) {
  103.                                         bmp.data[j-1][i].moy=255;
  104.                                     }
  105.                                 }
  106.                             }
  107.                             largeur++;
  108.                             if(longueur>longueur2) {      //cherche la longueur la plus grande
  109.                                 longueur2=longueur;
  110.                             }
  111.                             longueur=0;
  112.                         } while(bmp.data[j][i].moy==255);
  113.                         if(longueur2>8 && largeur>8) { //difference entre bille et parasite
  114.                             if(longueur2>largeur) {          //cherche la valeur la plus grande
  115.                                 bille=longueur2 * 0.07716 + 0.1543;     //calcul pour avoir le resultat en millimetre
  116.                             } else {
  117.                                 bille=largeur * 0.07716 +0.1543;
  118.                             }
  119.                             if(bille<8) {
  120.                                 fprintf(texte,"%.2f\n",bille);  //ecrit le resultat dans le fichier texte
  121.                                 nbrbille ++;
  122.                                 //  printf("%.2f\n",bille);    //debugage
  123.                             }
  124.                         }
  125.                         i=savi;                 //retourne au point sauvegardé
  126.                         j=savj;
  127.                     }
  128.                 }
  129.             }      //prepare l'ouverture de la prochaine image
  130.             fprintf(texte,"il y a %d bille(s) sur l'image\n",nbrbille);
  131.             fclose(texte);
  132.             for (i = 0; i < bmp.height; i++) {
  133.                 free(bmp.data[i]);
  134.             }
  135.             free(bmp.data);
  136.             remove(image);
  137.             nbrbille=0;
  138.         }
  139.     }
  140. }
  141. /***********sous programme**************/
  142. t_bmp bordure(t_bmp bmp)
  143. {
  144.     int i;
  145.     for (i = 0; i < bmp.width; ++i) {   // supprime toutes les billes touchant le bas de l'image
  146.         j=0;
  147.         if(bmp.data[j][i].moy < z) {
  148.             savi=i;
  149.             do {
  150.                 do {
  151.                     bmp.data[j][i].moy=255;
  152.                     i++;
  153.                     if(i==bmp.width) {
  154.                         break;
  155.                     }
  156.                 } while(bmp.data[j][i].moy<z);
  157.                 i=savi;
  158.                 j++;
  159.                 if(j==bmp.height) {
  160.                     break;
  161.                 }
  162.                 if(bmp.data[j][i].moy>z) {
  163.                     if(i<bmp.width-1) {
  164.                         if(bmp.data[j][i+1].moy<z) {
  165.                             i=i+1;
  166.                             savi=i;
  167.                         }
  168.                     }
  169.                 } else {
  170.                     while(bmp.data[j][i-1].moy<z && i>1) {
  171.                         i--;
  172.                     }
  173.                 }
  174.             } while(bmp.data[j][i].moy<z);
  175.         }
  176.     }
  177.     for(i=0; i<bmp.width; i++) { // supprime toutes les billes touchant le haut de l'image
  178.         j=bmp.height-1;
  179.         if(bmp.data[j][i].moy<z) {
  180.             savi=i;
  181.             do {
  182.                 do {
  183.                     bmp.data[j][i].moy=255;
  184.                     i++;
  185.                     if(i==bmp.width) {
  186.                         break;
  187.                     }
  188.                 } while(bmp.data[j][i].moy<z);
  189.                 i=savi;
  190.                 j--;
  191.                 if(bmp.data[j][i].moy>z) {
  192.                     if(i<bmp.width-1) {
  193.                         if(bmp.data[j][i+1].moy<z) {
  194.                             i=i+1;
  195.                             savi=i;
  196.                         }
  197.                     }
  198.                 } else {
  199.                     while(bmp.data[j][i-1].moy<z && i>1) {
  200.                         i--;
  201.                     }
  202.                 }
  203.             } while(bmp.data[j][i].moy<z && i<bmp.width-1);
  204.         }
  205.     }
  206.     for(j=0; j<bmp.height; j++) { // supprime toutes les billes touchant le bord gauche de l'image
  207.         i=0;
  208.         if(bmp.data[j][i].moy<z) {
  209.             savj=j;
  210.             do {
  211.                 do {
  212.                     bmp.data[j][i].moy=255;
  213.                     j++;
  214.                     if(j==bmp.height) {
  215.                         break;
  216.                     }
  217.                 } while(bmp.data[j][i].moy<z);
  218.                 j=savj;
  219.                 i++;
  220.                 if(i<bmp.width-1) {
  221.                     if(bmp.data[j][i].moy>z) {
  222.                         if(j<bmp.height-1) {
  223.                             if(bmp.data[j+1][i].moy<z) {
  224.                                 j=j+1;
  225.                                 savj=j;
  226.                             }
  227.                         }
  228.                     } else {
  229.                         while(bmp.data[j-1][i].moy<z) {
  230.                             j--;
  231.                             if(j==0) {
  232.                                 break;
  233.                             }
  234.                         }
  235.                     }
  236.                 }
  237.             } while(bmp.data[j][i].moy<z && j<bmp.height-1);
  238.         }
  239.     }
  240.     for(j=0; j<bmp.height; j++) { // supprime toutes les billes touchant le bord droit de l'image
  241.         i=bmp.width-1;
  242.         if(bmp.data[j][i].moy<z) {
  243.             savj=j;
  244.             do {
  245.                 do {
  246.                     bmp.data[j][i].moy=255;
  247.                     j++;
  248.                     if(j==bmp.height) {
  249.                         break;
  250.                     }
  251.                 } while(bmp.data[j][i].moy<z);
  252.                 j=savj;
  253.                 i--;
  254.                 if(bmp.data[j][i].moy>z) {
  255.                     if(j<bmp.height-1) {
  256.                         if(bmp.data[j+1][i].moy<z) {
  257.                             j=j+1;
  258.                             savj=j;
  259.                         }
  260.                     }
  261.                 } else {
  262.                     while(bmp.data[j-1][i].moy<z && j>1) {
  263.                         j--;
  264.                     }
  265.                 }
  266.             } while(bmp.data[j][i].moy<z && j<bmp.height-1);
  267.         }
  268.     }
  269.     return bmp;
  270. }
  271. /********************LPE*******************************/
  272. t_bmp LPE(t_bmp bmp)
  273. {
  274.     libbmp_load(image, &bmp1);
  275.     libbmp_load(image, &bmp2);
  276.     libbmp_load(image, &bmp3);
  277.     int fin=0;
  278.     for(i=0; i<bmp.width; i++) { //deplacement sur le pixel en largeur
  279.         for(j=0; j<bmp.height; j++) { // deplacement sur les pixel en hauteur
  280.             if(bmp.data[j][i].moy>z) {
  281.                 bmp.data[j][i].moy=255;
  282.                 /*bmp.data[j][i].r=255;bmp.data[j][i].g=255;bmp.data[j][i].b=255;*/
  283.             } //transforme l'image en image binaire
  284.             if(bmp.data[j][i].moy<z) {
  285.                 bmp.data[j][i].moy=0;
  286.                 /*bmp.data[j][i].r=0;bmp.data[j][i].g=0;bmp.data[j][i].b=0;*/
  287.             }
  288.             bmp.data[j][i].moy= 255 - bmp.data[j][i].moy;
  289.             //bmp.data[j][i].r= 255 - bmp.data[j][i].r;bmp.data[j][i].g= 255 - bmp.data[j][i].g;bmp.data[j][i].b= 255 - bmp.data[j][i].b;
  290.         }
  291.     }
  292.     for(i=1; i<bmp.width-1; i++) { //deplacement sur le pixel en largeur
  293.         for(j=1; j<bmp.height-1; j++) { // deplacement sur les pixel en hauteur
  294.             //premiere erosion
  295.             if(bmp.data[j][i].moy==255
  296.                     && bmp.data[j-1][i].moy==255
  297.                     && bmp.data[j][i-1].moy==255
  298.                     && bmp.data[j+1][i].moy==255
  299.                     && bmp.data[j][i+1].moy==255) {
  300.                 bmp1.data[j][i].moy=255;
  301.                 //bmp1.data[j][i].r=255;bmp1.data[j][i].g=255;bmp1.data[j][i].b=255;
  302.             } else if(bmp.data[j][i].moy==0
  303.                       || bmp.data[j-1][i].moy==0
  304.                       || bmp.data[j][i-1].moy==0
  305.                       || bmp.data[j+1][i].moy==0
  306.                       || bmp.data[j][i+1].moy==0) {
  307.                 bmp1.data[j][i].moy=0;//bmp1.data[j][i].r=0;bmp1.data[j][i].g=0;bmp1.data[j][i].b=0;
  308.             }
  309.         }
  310.     }
  311.     do { //erosion de taille 9
  312.         fin++;
  313.         for(i=1; i<bmp.width-1; i++) { //deplacement sur le pixel en largeur
  314.             for(j=1; j<bmp.height-1; j++) { // deplacement sur les pixel en hauteur
  315.                 if(bmp1.data[j][i].moy==255
  316.                         && bmp1.data[j-1][i].moy==255
  317.                         && bmp1.data[j][i-1].moy==255
  318.                         && bmp1.data[j+1][i].moy==255
  319.                         && bmp1.data[j][i+1].moy==255
  320.                         && bmp1.data[j-1][i+1].moy==255
  321.                         && bmp1.data[j+1][i+1].moy==255
  322.                         && bmp1.data[j-1][i-1].moy==255
  323.                         && bmp1.data[j+1][i-1].moy==255) {
  324.                     bmp2.data[j][i].moy=255;
  325.                     //bmp2.data[j][i].r=255;bmp2.data[j][i].g=255;bmp2.data[j][i].b=255;
  326.                 } else if(bmp1.data[j][i].moy==0
  327.                           || bmp1.data[j-1][i].moy==0
  328.                           || bmp1.data[j][i-1].moy==0
  329.                           || bmp1.data[j+1][i].moy==0
  330.                           || bmp1.data[j][i+1].moy==0
  331.                           || bmp1.data[j-1][i+1].moy==0
  332.                           || bmp1.data[j+1][i+1].moy==0
  333.                           || bmp1.data[j-1][i-1].moy==0
  334.                           || bmp1.data[j+1][i-1].moy==0) {
  335.                     bmp2.data[j][i].moy=0;
  336.                     //bmp2.data[j][i].r=0;bmp2.data[j][i].g=0;bmp2.data[j][i].b=0;
  337.                 }
  338.             }
  339.         }
  340.         for(i=0; i<bmp.width; i++) { //deplacement sur le pixel en largeur
  341.             for(j=0; j<bmp.height; j++) { // deplacement sur les pixel en hauteur
  342.                 bmp1.data[j][i].moy = bmp2.data[j][i].moy;
  343.             }
  344.         }
  345.     } while(fin != 9);
  346.     //   sprintf(nouvelle,"image%dbmp1.bmp",k);
  347.     //   libbmp_write(nouvelle,&bmp1);  //debugage
  348.     bmp3=dilatation(bmp2,bmp3);  //dilatation
  349.     //       sprintf(nouvelle,"image%dbmp2.bmp",k);
  350.     //       libbmp_write(nouvelle,&bmp2);  //debugage
  351.     //       sprintf(nouvelle,"image%dbmp3.bmp",k);
  352.     //       libbmp_write(nouvelle,&bmp3);  //debugage
  353.     for(i=0; i<bmp.width; i++) { //deplacement sur le pixel en largeur
  354.         for(j=0; j<bmp.height; j++) { // deplacement sur les pixel en hauteur
  355.             bmp.data[j][i].moy *= bmp3.data[j][i].moy; //decolle les billes collées
  356.             if(bmp.data[j][i].moy != 0) {    // transforme l'image en image binaire
  357.                 bmp.data[j][i].moy=255;
  358.             }
  359.         }
  360.     }
  361.     for (i = 0; i < bmp.height; i++) {
  362.         free(bmp1.data[i]);
  363.         free(bmp2.data[i]);
  364.         free(bmp3.data[i]);
  365.     }
  366.     free(bmp1.data);
  367.     free(bmp2.data);
  368.     free(bmp3.data);
  369.     return bmp;
  370. }
  371. t_bmp dilatation (t_bmp bmp2,t_bmp bmp3)
  372. {
  373.     a=0;
  374.     b=0;
  375.     c=0;
  376.     int l, fin=0;
  377.     for(i=0; i<bmp2.width; i++) { //deplacement sur le pixel en largeur
  378.         for(j=0; j<bmp2.height; j++) { // deplacement sur les pixel en hauteur
  379.             a+=20; //labelisation de l'image
  380.             if(a>255) {
  381.                 a=0;
  382.                 b+=20;
  383.             }
  384.             if(b>255) {
  385.                 b=0;
  386.                 c+=20;
  387.             }
  388.             if(bmp2.data[j][i].moy==255) { //recherche de pixel blanc
  389.                 savi=i;     //sauvegarde la position du point
  390.                 savj=j;
  391.                 do  {//double boucle pour labelisé les billes
  392.                     do {
  393.                         bmp2.data[j][i].moy=(a+b+c)/3;   //change la couleur du pixel
  394.                         //bmp2.data[j][i].r=a;
  395.                         //bmp2.data[j][i].b=b;
  396.                         //bmp2.data[j][i].g=c;
  397.                         j++;
  398.                         if(j==bmp2.height) {
  399.                             break;
  400.                         }
  401.                     } while(bmp2.data[j][i].moy==255);
  402.                     j=savj;
  403.                     i++;
  404.                     if(bmp2.data[j][i].moy==0) {
  405.                         for(l=1; l<15; l++) {
  406.                             if(bmp2.data[j+l][i].moy==255) {
  407.                                 j=j+l;
  408.                                 savj=j;
  409.                                 break;
  410.                             }
  411.                         }
  412.                     } else {
  413.                         if(j>0) {
  414.                             while(bmp2.data[j-1][i].moy==255 && j>1) {
  415.                                 j--;
  416.                             }
  417.                         }
  418.                     }
  419.                 } while(bmp2.data[j][i].moy==255);
  420.                 j=savj;
  421.                 i=savi;
  422.             }
  423.         }
  424.     }
  425.     for(i=0; i<bmp2.width; i++) { //deplacement sur le pixel en largeur
  426.         for(j=0; j<bmp2.height; j++) { // deplacement sur les pixel en hauteur
  427.             bmp3.data[j][i].moy = bmp2.data[j][i].moy;  //copie de donnée
  428.             // bmp3.data[j][i].r = bmp2.data[j][i].r;
  429.             // bmp3.data[j][i].g = bmp2.data[j][i].g;
  430.             // bmp3.data[j][i].b = bmp2.data[j][i].b;
  431.         }
  432.     }
  433.     // sprintf(nouvelle,"image%dbmp31.bmp",k);
  434.     //  libbmp_write(nouvelle,&bmp3);  //debugage
  435.     do { //dilatation sous contrainte de 40
  436.         fin++;
  437.         for(i=2; i<bmp2.width-2; i++) { //deplacement sur le pixel en largeur
  438.             for(j=2; j<bmp2.height-2; j++) { // deplacement sur les pixel en hauteur
  439.                 if(bmp2.data[j][i].moy!=0) {
  440.                     if(bmp2.data[j-1][i].moy==0) {
  441.                         if(((bmp2.data[j-2][i].moy==0 || bmp2.data[j-2][i].moy==bmp2.data[j][i].moy)
  442.                                 && (bmp3.data[j-2][i].moy==0 || bmp3.data[j-2][i].moy==bmp2.data[j][i].moy))
  443.                                 && ((bmp2.data[j-2][i+1].moy==0 || bmp2.data[j-2][i+1].moy==bmp2.data[j][i].moy)
  444.                                     && (bmp3.data[j-2][i+1].moy==0 || bmp3.data[j-2][i+1].moy==bmp2.data[j][i].moy))
  445.                                 && ((bmp2.data[j-2][i-1].moy==0 || bmp2.data[j-2][i-1].moy==bmp2.data[j][i].moy)
  446.                                     && (bmp3.data[j-2][i-1].moy==0 || bmp3.data[j-2][i-1].moy==bmp2.data[j][i].moy))) {
  447.                             bmp3.data[j-1][i].moy=bmp3.data[j][i].moy;
  448.                             //bmp3.data[j-1][i].r=bmp3.data[j][i].r;bmp3.data[j-1][i].g=bmp3.data[j][i].g;bmp3.data[j-1][i].b=bmp3.data[j][i].b;
  449.                         }
  450.                     }
  451.                     if(bmp2.data[j+1][i].moy==0) {
  452.                         if(((bmp2.data[j+2][i].moy==0 || bmp2.data[j+2][i].moy==bmp2.data[j][i].moy)
  453.                                 && (bmp3.data[j+2][i].moy==0 || bmp3.data[j+2][i].moy==bmp2.data[j][i].moy))
  454.                                 && ((bmp2.data[j+2][i+1].moy==0 || bmp2.data[j+2][i+1].moy==bmp2.data[j][i].moy)
  455.                                     && (bmp3.data[j+2][i+1].moy==0 || bmp3.data[j+2][i+1].moy==bmp2.data[j][i].moy))
  456.                                 && ((bmp2.data[j+2][i-1].moy==0 || bmp2.data[j+2][i-1].moy==bmp2.data[j][i].moy)
  457.                                     && (bmp3.data[j+2][i-1].moy==0 || bmp3.data[j+2][i-1].moy==bmp3.data[j][i].moy))) {
  458.                             bmp3.data[j+1][i].moy=bmp3.data[j][i].moy;
  459.                             //bmp3.data[j+1][i].r=bmp3.data[j][i].r;bmp3.data[j+1][i].g=bmp3.data[j][i].g;bmp3.data[j+1][i].b=bmp3.data[j][i].b;
  460.                         }
  461.                     }
  462.                     if(bmp2.data[j][i+1].moy==0) {
  463.                         if(((bmp2.data[j][i+2].moy==0 || bmp2.data[j][i+2].moy==bmp2.data[j][i].moy)
  464.                                 && (bmp3.data[j][i+2].moy==0 || bmp3.data[j][i+2].moy==bmp2.data[j][i].moy))
  465.                                 && ((bmp2.data[j-1][i+2].moy==0 || bmp2.data[j-1][i+2].moy==bmp2.data[j][i].moy)
  466.                                     && (bmp3.data[j-1][i+2].moy==0 || bmp3.data[j-1][i+2].moy==bmp2.data[j][i].moy))
  467.                                 && ((bmp2.data[j+1][i+2].moy==0 || bmp2.data[j+1][i+2].moy==bmp2.data[j][i].moy)
  468.                                     && (bmp3.data[j+1][i+2].moy==0 || bmp3.data[j+1][i+2].moy==bmp2.data[j][i].moy))) {
  469.                             bmp3.data[j][i+1].moy=bmp3.data[j][i].moy;
  470.                             //bmp3.data[j][i+1].r=bmp3.data[j][i].r;bmp3.data[j][i+1].g=bmp3.data[j][i].g;bmp3.data[j][i+1].b=bmp3.data[j][i].b;
  471.                         }
  472.                     }
  473.                     if(bmp2.data[j][i-1].moy==0) {
  474.                         if(((bmp2.data[j][i-2].moy==0 || bmp2.data[j][i-2].moy==bmp2.data[j][i].moy)
  475.                                 && (bmp3.data[j][i-2].moy==0 || bmp3.data[j][i-2].moy==bmp2.data[j][i].moy))
  476.                                 && ((bmp2.data[j-1][i-2].moy==0 || bmp2.data[j-1][i-2].moy==bmp2.data[j][i].moy)
  477.                                     && (bmp3.data[j-1][i-2].moy==0 || bmp3.data[j-1][i-2].moy==bmp2.data[j][i].moy))
  478.                                 && ((bmp2.data[j+1][i-2].moy==0 || bmp2.data[j+1][i-2].moy==bmp2.data[j][i].moy)
  479.                                     && (bmp3.data[j+1][i-2].moy==0 || bmp3.data[j+1][i-2].moy==bmp2.data[j][i].moy))) {
  480.                             bmp3.data[j][i-1].moy=bmp3.data[j][i].moy;
  481.                             //bmp3.data[j][i-1].r=bmp3.data[j][i].r;bmp3.data[j][i-1].g=bmp3.data[j][i].g;bmp3.data[j][i-1].b=bmp3.data[j][i].b;
  482.                         }
  483.                     }
  484.                 }
  485.                 bmp2.data[j][i].moy = bmp3.data[j][i].moy;
  486.             }
  487.         }
  488.     } while(fin!= 40);
  489.     return bmp3;
  490. }


C'est quasiment un cas d'école de tout ce qu'il ne faut pas faire, ce truc.
On va pouvoir détailler.
A+,


Message édité par gilou le 19-04-2013 à 13:57:11

---------------
There's more than what can be linked! --    Iyashikei Anime Forever!    --  AngularJS c'est un framework d'engulé!  --

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  C

  probleme fuite de memoire

 

Sujets relatifs
Petit probleme de batchProblème d'accent dans un mail.php uniquement les requêtes sql
[AJAX] problème d'etat...Problème de mise en page selon le navigateur
Probleme de liaison à l'interfaceProblème pour actualiser les valeurs d'une Trackbar
Problème lors de la génération de la javadocproblème de manipulation/réorganisation de fichiers
Erreur Mémoire insuffisante. Comment optimiserproblème de fuite mémoire
Plus de sujets relatifs à : probleme fuite de memoire


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR