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

Langage Delphi Discussion :

Problème simple de fuite mémoire


Sujet :

Langage Delphi

  1. #1
    Membre habitué
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mars 2002
    Messages
    147
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Mars 2002
    Messages : 147
    Points : 144
    Points
    144
    Par défaut Problème simple de fuite mémoire
    bonjour
    J'ai un problème de fuites mémoires. Ca devrait être simple pour vous de répondre. Voici mon problème:
    J'utilise memCheck pour pister les fuites mémoire.
    Une form avec un combobox dessus, et un bouton.
    Dans mon code, une fonction :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    Function RetournerTStringList():TStringList;
    begin
         Result:=TStringList.Create();
         Result.Add('2344°');
    end;
    puis sur le onClick du button:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    procedure TForm1.Button2Click(Sender: TObject);
    begin
         combobox1.Items.Clear;
         Combobox1.Items.AddStrings(RetournerTStringList);
    end;
    A la fin de l'exécution, memcheck ouvre le notepad et me sort ça:
    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
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    MemCheck version 2.75
     
    TOP 10 Leaks: begin
    Leak #2 User allocated memory (GetMem)
    	Size: 48
    	1 Occurence
    	call stack - 0 : (no debug info) Find error: 40003A45
    	call stack - 1 : Module Unit1.pas Routine @Unit1@TForm1@Button2Click Line 131 Find error: 004081B9
    	call stack - 2 : (no debug info) Find error: 4006B794
    	call stack - 3 : (no debug info) Find error: 40047D19
    	call stack - 4 : (no debug info) Find error: 4006E2E4
    	call stack - 5 : (no debug info) Find error: 40053FF3
    	call stack - 6 : (no debug info) Find error: 4006DDB7
    	call stack - 7 : (no debug info) Find error: 400510B2
    	call stack - 8 : (no debug info) Find error: 7E398730
    	call stack - 9 : (no debug info) Find error: 7E398812
    	call stack - 10 : (no debug info) Find error: 7E39C63B
    	call stack - 11 : (no debug info) Find error: 7E39C661
    	call stack - 12 : (no debug info) Find error: 58B55E5A
    	call stack - 13 : (no debug info) Find error: 58B5602B
    	call stack - 14 : (no debug info) Find error: 58B55FE0
    	call stack - 15 : (no debug info) Find error: 58B904BB
    	call stack - 16 : (no debug info) Find error: 58B5602B
    	call stack - 17 : (no debug info) Find error: 58B560BA
    	call stack - 18 : (no debug info) Find error: 7E398730
    	call stack - 19 : (no debug info) Find error: 7E398812
    	call stack - 20 : (no debug info) Find error: 7E39B897
    	call stack - 21 : (no debug info) Find error: 7E39B8FF
    	call stack - 22 : (no debug info) Find error: 7E3CFD19
    	call stack - 23 : (no debug info) Find error: 7E3C655D
    	call stack - 24 : (no debug info) Find error: 7E3A6DF0
    	call stack - 25 : (no debug info) Find error: 7E3BB046
    	call stack - 26 : (no debug info) Find error: 7E398730
     
    Leak #1 User allocated memory (GetMem)
    	Size: 32
    	1 Occurence
    	call stack - 0 : (no debug info) Find error: 02687500
    	call stack - 1 : Module Unit1.pas Routine @Unit1@TForm1@Button2Click Line 131 Find error: 004081B9
    	call stack - 2 : (no debug info) Find error: 4006B794
    	call stack - 3 : (no debug info) Find error: 40047D19
    	call stack - 4 : (no debug info) Find error: 4006E2E4
    	call stack - 5 : (no debug info) Find error: 40053FF3
    	call stack - 6 : (no debug info) Find error: 4006DDB7
    	call stack - 7 : (no debug info) Find error: 400510B2
    	call stack - 8 : (no debug info) Find error: 7E398730
    	call stack - 9 : (no debug info) Find error: 7E398812
    	call stack - 10 : (no debug info) Find error: 7E39C63B
    	call stack - 11 : (no debug info) Find error: 7E39C661
    	call stack - 12 : (no debug info) Find error: 58B55E5A
    	call stack - 13 : (no debug info) Find error: 58B5602B
    	call stack - 14 : (no debug info) Find error: 58B55FE0
    	call stack - 15 : (no debug info) Find error: 58B904BB
    	call stack - 16 : (no debug info) Find error: 58B5602B
    	call stack - 17 : (no debug info) Find error: 58B560BA
    	call stack - 18 : (no debug info) Find error: 7E398730
    	call stack - 19 : (no debug info) Find error: 7E398812
    	call stack - 20 : (no debug info) Find error: 7E39B897
    	call stack - 21 : (no debug info) Find error: 7E39B8FF
    	call stack - 22 : (no debug info) Find error: 7E3CFD19
    	call stack - 23 : (no debug info) Find error: 7E3C655D
    	call stack - 24 : (no debug info) Find error: 7E3A6DF0
    	call stack - 25 : (no debug info) Find error: 7E3BB046
    	call stack - 26 : (no debug info) Find error: 7E398730
     
    Leak #0 User allocated memory (GetMem)
    	Size: 14
    	1 Occurence
    	call stack - 0 : (no debug info) Find error: 40004BB5
    	call stack - 1 : Module Unit1.pas Routine @Unit1@TForm1@Button2Click Line 131 Find error: 004081B9
    	call stack - 2 : (no debug info) Find error: 4006B794
    	call stack - 3 : (no debug info) Find error: 40047D19
    	call stack - 4 : (no debug info) Find error: 4006E2E4
    	call stack - 5 : (no debug info) Find error: 40053FF3
    	call stack - 6 : (no debug info) Find error: 4006DDB7
    	call stack - 7 : (no debug info) Find error: 400510B2
    	call stack - 8 : (no debug info) Find error: 7E398730
    	call stack - 9 : (no debug info) Find error: 7E398812
    	call stack - 10 : (no debug info) Find error: 7E39C63B
    	call stack - 11 : (no debug info) Find error: 7E39C661
    	call stack - 12 : (no debug info) Find error: 58B55E5A
    	call stack - 13 : (no debug info) Find error: 58B5602B
    	call stack - 14 : (no debug info) Find error: 58B55FE0
    	call stack - 15 : (no debug info) Find error: 58B904BB
    	call stack - 16 : (no debug info) Find error: 58B5602B
    	call stack - 17 : (no debug info) Find error: 58B560BA
    	call stack - 18 : (no debug info) Find error: 7E398730
    	call stack - 19 : (no debug info) Find error: 7E398812
    	call stack - 20 : (no debug info) Find error: 7E39B897
    	call stack - 21 : (no debug info) Find error: 7E39B8FF
    	call stack - 22 : (no debug info) Find error: 7E3CFD19
    	call stack - 23 : (no debug info) Find error: 7E3C655D
    	call stack - 24 : (no debug info) Find error: 7E3A6DF0
    	call stack - 25 : (no debug info) Find error: 7E3BB046
    	call stack - 26 : (no debug info) Find error: 7E398730
     
    TOP 10 Leaks: end
     
    Total leak: 94 bytes
     
     
    *** MEMCHK: Blocks STILL allocated ***
     
    Leak #0 User allocated memory (GetMem)
    	Size: 14
    	1 Occurence
    	call stack - 0 : (no debug info) Find error: 40004BB5
    	call stack - 1 : Module Unit1.pas Routine @Unit1@TForm1@Button2Click Line 131 Find error: 004081B9
    	call stack - 2 : (no debug info) Find error: 4006B794
    	call stack - 3 : (no debug info) Find error: 40047D19
    	call stack - 4 : (no debug info) Find error: 4006E2E4
    	call stack - 5 : (no debug info) Find error: 40053FF3
    	call stack - 6 : (no debug info) Find error: 4006DDB7
    	call stack - 7 : (no debug info) Find error: 400510B2
    	call stack - 8 : (no debug info) Find error: 7E398730
    	call stack - 9 : (no debug info) Find error: 7E398812
    	call stack - 10 : (no debug info) Find error: 7E39C63B
    	call stack - 11 : (no debug info) Find error: 7E39C661
    	call stack - 12 : (no debug info) Find error: 58B55E5A
    	call stack - 13 : (no debug info) Find error: 58B5602B
    	call stack - 14 : (no debug info) Find error: 58B55FE0
    	call stack - 15 : (no debug info) Find error: 58B904BB
    	call stack - 16 : (no debug info) Find error: 58B5602B
    	call stack - 17 : (no debug info) Find error: 58B560BA
    	call stack - 18 : (no debug info) Find error: 7E398730
    	call stack - 19 : (no debug info) Find error: 7E398812
    	call stack - 20 : (no debug info) Find error: 7E39B897
    	call stack - 21 : (no debug info) Find error: 7E39B8FF
    	call stack - 22 : (no debug info) Find error: 7E3CFD19
    	call stack - 23 : (no debug info) Find error: 7E3C655D
    	call stack - 24 : (no debug info) Find error: 7E3A6DF0
    	call stack - 25 : (no debug info) Find error: 7E3BB046
    	call stack - 26 : (no debug info) Find error: 7E398730
     
    Leak #1 User allocated memory (GetMem)
    	Size: 32
    	1 Occurence
    	call stack - 0 : (no debug info) Find error: 02687500
    	call stack - 1 : Module Unit1.pas Routine @Unit1@TForm1@Button2Click Line 131 Find error: 004081B9
    	call stack - 2 : (no debug info) Find error: 4006B794
    	call stack - 3 : (no debug info) Find error: 40047D19
    	call stack - 4 : (no debug info) Find error: 4006E2E4
    	call stack - 5 : (no debug info) Find error: 40053FF3
    	call stack - 6 : (no debug info) Find error: 4006DDB7
    	call stack - 7 : (no debug info) Find error: 400510B2
    	call stack - 8 : (no debug info) Find error: 7E398730
    	call stack - 9 : (no debug info) Find error: 7E398812
    	call stack - 10 : (no debug info) Find error: 7E39C63B
    	call stack - 11 : (no debug info) Find error: 7E39C661
    	call stack - 12 : (no debug info) Find error: 58B55E5A
    	call stack - 13 : (no debug info) Find error: 58B5602B
    	call stack - 14 : (no debug info) Find error: 58B55FE0
    	call stack - 15 : (no debug info) Find error: 58B904BB
    	call stack - 16 : (no debug info) Find error: 58B5602B
    	call stack - 17 : (no debug info) Find error: 58B560BA
    	call stack - 18 : (no debug info) Find error: 7E398730
    	call stack - 19 : (no debug info) Find error: 7E398812
    	call stack - 20 : (no debug info) Find error: 7E39B897
    	call stack - 21 : (no debug info) Find error: 7E39B8FF
    	call stack - 22 : (no debug info) Find error: 7E3CFD19
    	call stack - 23 : (no debug info) Find error: 7E3C655D
    	call stack - 24 : (no debug info) Find error: 7E3A6DF0
    	call stack - 25 : (no debug info) Find error: 7E3BB046
    	call stack - 26 : (no debug info) Find error: 7E398730
     
    Leak #2 User allocated memory (GetMem)
    	Size: 48
    	1 Occurence
    	call stack - 0 : (no debug info) Find error: 40003A45
    	call stack - 1 : Module Unit1.pas Routine @Unit1@TForm1@Button2Click Line 131 Find error: 004081B9
    	call stack - 2 : (no debug info) Find error: 4006B794
    	call stack - 3 : (no debug info) Find error: 40047D19
    	call stack - 4 : (no debug info) Find error: 4006E2E4
    	call stack - 5 : (no debug info) Find error: 40053FF3
    	call stack - 6 : (no debug info) Find error: 4006DDB7
    	call stack - 7 : (no debug info) Find error: 400510B2
    	call stack - 8 : (no debug info) Find error: 7E398730
    	call stack - 9 : (no debug info) Find error: 7E398812
    	call stack - 10 : (no debug info) Find error: 7E39C63B
    	call stack - 11 : (no debug info) Find error: 7E39C661
    	call stack - 12 : (no debug info) Find error: 58B55E5A
    	call stack - 13 : (no debug info) Find error: 58B5602B
    	call stack - 14 : (no debug info) Find error: 58B55FE0
    	call stack - 15 : (no debug info) Find error: 58B904BB
    	call stack - 16 : (no debug info) Find error: 58B5602B
    	call stack - 17 : (no debug info) Find error: 58B560BA
    	call stack - 18 : (no debug info) Find error: 7E398730
    	call stack - 19 : (no debug info) Find error: 7E398812
    	call stack - 20 : (no debug info) Find error: 7E39B897
    	call stack - 21 : (no debug info) Find error: 7E39B8FF
    	call stack - 22 : (no debug info) Find error: 7E3CFD19
    	call stack - 23 : (no debug info) Find error: 7E3C655D
    	call stack - 24 : (no debug info) Find error: 7E3A6DF0
    	call stack - 25 : (no debug info) Find error: 7E3BB046
    	call stack - 26 : (no debug info) Find error: 7E398730
     
    *** MEMCHK: End of allocated blocks ***
     
     
    *** MEMCHK: Chronological leak information ***
     
    * User allocated memory (GetMem) (Leak #2) Size: 48
    * User allocated memory (GetMem) (Leak #1) Size: 32
    * User allocated memory (GetMem) (Leak #0) Size: 14
     
    *** MEMCHK: End of chronological leak information ***
     
     
    *** MEMCHK: Blocks written to after destruction ***
     
    	Bad blocks count: 0
     
     
    *** MEMCHK: End of blocks written to after destruction ***
    Bon désolé c'est un peu gros...
    Je ne sais pas comment libérer le result que je crée. Pouvez vous me dire comment je dois écrire ma fonction qui renvoie un TStringList?

    PS: quand je n'appelle pas la fonction qui renvoie la stringlist, memCheck n'apparait pas, donc pas de fuite mémoire.

    Merci

    Edit:
    J'ai rajouté un bien moche:
    aprés le ComboBox1.Items.Add et j'ai une runtime error. De toutes façons ça me paraissait bizarre de faire ça...

  2. #2
    Expert éminent
    Avatar de Qwazerty
    Homme Profil pro
    La très haute tension :D
    Inscrit en
    Avril 2002
    Messages
    3 906
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : France

    Informations professionnelles :
    Activité : La très haute tension :D
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2002
    Messages : 3 906
    Points : 8 539
    Points
    8 539
    Par défaut
    Salut
    Et si tu faisais une recherche sur le forum, y'a eu 2 fois cette question en 1 semaine
    Bon j'arrive pas a la retrouver avec la recherche...
    A++
    Qwaz

  3. #3
    Membre habitué
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mars 2002
    Messages
    147
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Mars 2002
    Messages : 147
    Points : 144
    Points
    144
    Par défaut Désolé...
    Désolé... J'ai fait une recherche mais pas trés approfondie...
    Je vais rechercher de ce pas.

    Edit: Ca y est j'ai trouvé, voici le post:
    http://www.developpez.net/forums/sho...d.php?t=448078

  4. #4
    Expert éminent
    Avatar de Qwazerty
    Homme Profil pro
    La très haute tension :D
    Inscrit en
    Avril 2002
    Messages
    3 906
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : France

    Informations professionnelles :
    Activité : La très haute tension :D
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2002
    Messages : 3 906
    Points : 8 539
    Points
    8 539
    Par défaut
    Et moi je continu .. je met des reponse dans le mauvais files...
    J'avais mis ca

    ... bon j'ai eu du mal a la retrouver ... je suis ben naze
    la voila
    http://www.developpez.net/forums/sho...d.php?t=448078

    A++
    Qwaz
    Mais bon tu as trouvé

Discussions similaires

  1. Problème de fuites mémoire
    Par Le Barde dans le forum C++
    Réponses: 12
    Dernier message: 02/09/2007, 08h49
  2. Problème fuite mémoire
    Par devconf77 dans le forum Windows
    Réponses: 3
    Dernier message: 30/08/2007, 18h33
  3. [VB6] Problème de fuite mémoire
    Par GyLes dans le forum VB 6 et antérieur
    Réponses: 5
    Dernier message: 19/03/2007, 14h58
  4. [C++] problème de fuite mémoire
    Par Cirdan Telemnar dans le forum C++
    Réponses: 26
    Dernier message: 16/06/2006, 10h16
  5. Problème de fuite mémoire sur un idFTP
    Par jeromelef dans le forum Composants VCL
    Réponses: 6
    Dernier message: 26/07/2005, 17h29

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