Bonjour,

Je pense avoir un problème de mémoire lors de l'appel de ma fonction.
Voici ma fonction:
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
int algo1(int taille1, int taille2){
char chaineS[taille1],chaineT[taille2];
int **tabcomp , k;
tabcomp = malloc( taille1 * sizeof(int*));
if( tabcomp == NULL )
{
fprintf(stderr,"Allocation impossible");
exit(EXIT_FAILURE);
}
for( k = 0 ; k < taille1 ; k++ )
{
tabcomp[k] = calloc (taille2, sizeof(int));
if( tabcomp[k] == NULL )
{
fprintf(stderr,"Allocation impossible");
exit(EXIT_FAILURE);
}
}
generemot(chaineS, taille1);
generemot(chaineT, taille2);
int i,j,max=0, posL;
 
/*Initialisation de la premiere ligne*/
for (i=1;i<=taille1; i++){
   if (chaineT[1]==chaineS[i]){tabcomp[1][i]=1;}
}
/*Intialisation de la première colonne*/
for (i=1;i<=taille2; i++){
 if (chaineS[1]== chaineT[i]){tabcomp[i][1]=1;}
}
for(i=2;i<=taille1;i++){
    for (j=2;j<=taille2;j++){
       if (chaineS[j]==chaineT[i]){
            tabcomp[i][j]=tabcomp[i-1][j-1] +1 ;
       }
       else {tabcomp[i][j]=0;}
}
}
//recherche de la valeur maximale dans le tableau
for(i=1;i<=taille1;i++){
    for (j=1;j<=taille2;j++){
       if (tabcomp[i][j]> max ){
           max =tabcomp[i][j];
           posL = i;
       }
   }
}
free(tabcomp);
tabcomp = NULL;
return max;
}
Je dois appeler cette fonction de multiples fois et la valeur de taille 1 et de taille 2 augmente de 10 en 10. Cependant l'exécution s'interrompt rapidement avant d'avoir la totalité des résultats attendus.
J'aimerais pouvoir appeler la fonction jusqu'à obtenir une matrice de 4000 par 4000, voir même plus.

Merci par avance.