Vazamento de memoria

Delphi

19/05/2012

Ola pessoal estou com problema de vazamento de memória porém nao estou sabendo como resolver, estou usando o MemCheck para detectar onde está o problema, e como resposta estou tendo:

(A linha em questão é a linha que faz a conexao do banco de dados utilizo o sqlconnection + sqldataset + datasetprovider + clientdataset e o banco de dados eh o firebird 2,5)

vlw


MemCheck version 2.75

TOP 10 Leaks: begin
Leak #1 User allocated memory (GetMem)
Size: 50
1 Occurence
call stack - 0 : (no debug info) Find error: 00000032
call stack - 1 : Module DataModulo.pas Routine @Datamodulo@Tdm@DataModuleCreate Line 224 Find error: 009B9680
call stack - 2 : Routine @Classes@TDataModule@DoCreate Find error: 0042CC8E
call stack - 3 : Routine @Classes@TDataModule@AfterConstruction Find error: 0042CB3B
call stack - 4 : Routine @Forms@TApplication@CreateForm Find error: 0049DF58
call stack - 5 : Module Executavel.dpr Routine initialization Line 414 Find error: 00CD910C
call stack - 6 : (no debug info) Find error: 76A73396
call stack - 7 : (no debug info) Find error: 775A9EEE
call stack - 8 : (no debug info) Find error: 775A9EC1
call stack - 9 : (no debug info) Find error: FFFFFFFC

Leak #0 User allocated memory (GetMem)
Size: 8
1 Occurence
call stack - 0 : (no debug info) Find error: 0589A610
call stack - 1 : Module DataModulo.pas Routine @Datamodulo@Tdm@DataModuleCreate Line 224 Find error: 009B9680
call stack - 2 : Routine @Classes@TDataModule@DoCreate Find error: 0042CC8E
call stack - 3 : Routine @Classes@TDataModule@AfterConstruction Find error: 0042CB3B
call stack - 4 : Routine @Forms@TApplication@CreateForm Find error: 0049DF58
call stack - 5 : Module Executavel.dpr Routine initialization Line 414 Find error: 00CD910C
call stack - 6 : (no debug info) Find error: 76A73396
call stack - 7 : (no debug info) Find error: 775A9EEE
call stack - 8 : (no debug info) Find error: 775A9EC1
call stack - 9 : (no debug info) Find error: FFFFFFFC

TOP 10 Leaks: end

Total leak: 58 bytes


*** MEMCHK: Blocks STILL allocated ***

Leak #0 User allocated memory (GetMem)
Size: 8
1 Occurence
call stack - 0 : (no debug info) Find error: 0589A610
call stack - 1 : Module DataModulo.pas Routine @Datamodulo@Tdm@DataModuleCreate Line 224 Find error: 009B9680
call stack - 2 : Routine @Classes@TDataModule@DoCreate Find error: 0042CC8E
call stack - 3 : Routine @Classes@TDataModule@AfterConstruction Find error: 0042CB3B
call stack - 4 : Routine @Forms@TApplication@CreateForm Find error: 0049DF58
call stack - 5 : Module Executavel.dpr Routine initialization Line 414 Find error: 00CD910C
call stack - 6 : (no debug info) Find error: 76A73396
call stack - 7 : (no debug info) Find error: 775A9EEE
call stack - 8 : (no debug info) Find error: 775A9EC1
call stack - 9 : (no debug info) Find error: FFFFFFFC

Leak #1 User allocated memory (GetMem)
Size: 50
1 Occurence
call stack - 0 : (no debug info) Find error: 00000032
call stack - 1 : Module DataModulo.pas Routine @Datamodulo@Tdm@DataModuleCreate Line 224 Find error: 009B9680
call stack - 2 : Routine @Classes@TDataModule@DoCreate Find error: 0042CC8E
call stack - 3 : Routine @Classes@TDataModule@AfterConstruction Find error: 0042CB3B
call stack - 4 : Routine @Forms@TApplication@CreateForm Find error: 0049DF58
call stack - 5 : Module Executavel.dpr Routine initialization Line 414 Find error: 00CD910C
call stack - 6 : (no debug info) Find error: 76A73396
call stack - 7 : (no debug info) Find error: 775A9EEE
call stack - 8 : (no debug info) Find error: 775A9EC1
call stack - 9 : (no debug info) Find error: FFFFFFFC

*** MEMCHK: End of allocated blocks ***


*** MEMCHK: Chronological leak information ***

* User allocated memory (GetMem) (Leak #1) Size: 50
* User allocated memory (GetMem) (Leak #0) Size: 8

*** MEMCHK: End of chronological leak information ***


*** MEMCHK: Blocks written to after destruction ***

Bad blocks count: 0


*** MEMCHK: End of blocks written to after destruction ***
Ricardo Matarazzo

Ricardo Matarazzo

Curtidas 0

Respostas

Bruno Leandro

Bruno Leandro

19/05/2012

existe muito codigo no seu datamodule ? por volta da Linha 224, qual a funcionalidade.
GOSTEI 0
Ricardo Matarazzo

Ricardo Matarazzo

19/05/2012

Não, na realidade esta linha chama a abertura do banco de dados que esta em uma unit de biblioteca, e o codigo é

begin
{conecta banco}
dm.SQLConnection1.Connected := false;

caminhofb := ParamStr(0);
caminhofb := ExtractFilePath(caminhofb);
CaminhoI := tIniFile.Create(caminhofb + config.Ini);

if trim(ParamStr(5)) = then
Xcaminho := CaminhoI.ReadString(Banco,database,XCaminho)
else
Xcaminho := ParamStr(5);

if trim(Xcaminho) = then Xcaminho := caminhofb + banco\database.gdb;

with dm.SQLConnection1 do
begin
Params.Values[DataBase] := Xcaminho;
Params.Values[Password] := masterkey;
Params.Values[User_Name] := SYSDBA;
Params.Values[ServerCharSet] := WIN1252;
LibraryName := caminhofb + dbexpUIBfire15.dll;
Connected := True;
end;

with dm.IBDatabase1 do
begin
Connected := false;
LoginPrompt := false;
DatabaseName := xcaminho;
Params.Add(user_name=SYSDBA);
Params.Add(password=masterkey);
Params.Add(lc_ctype=WIN1252);
Connected := true;
end;

dm.IBTransaction1.Active := true;

if not DirectoryExists(ExtractFilePath(Application.ExeName) + ctg) then ForceDirectories(ExtractFilePath(Application.ExeName)+ ctg);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + ctr) then ForceDirectories(ExtractFilePath(Application.ExeName)+ ctr);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + dow) then ForceDirectories(ExtractFilePath(Application.ExeName)+ dow);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + ecf) then ForceDirectories(ExtractFilePath(Application.ExeName)+ ecf);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + exp) then ForceDirectories(ExtractFilePath(Application.ExeName)+ exp);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + exp\zerado) then ForceDirectories(ExtractFilePath(Application.ExeName)+ exp\zerado);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + figs) then ForceDirectories(ExtractFilePath(Application.ExeName)+ figs);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + fto) then ForceDirectories(ExtractFilePath(Application.ExeName)+ fto);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + nfp) then ForceDirectories(ExtractFilePath(Application.ExeName)+ nfp);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + plm) then ForceDirectories(ExtractFilePath(Application.ExeName)+ plm);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + rep) then ForceDirectories(ExtractFilePath(Application.ExeName)+ rep);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + tmp) then ForceDirectories(ExtractFilePath(Application.ExeName)+ tmp);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + smart) then ForceDirectories(ExtractFilePath(Application.ExeName)+ smart);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + log) then ForceDirectories(ExtractFilePath(Application.ExeName)+ log);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + Esquemas) then ForceDirectories(ExtractFilePath(Application.ExeName)+ Esquemas);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + Templates) then ForceDirectories(ExtractFilePath(Application.ExeName)+ Templates);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + sql) then ForceDirectories(ExtractFilePath(Application.ExeName)+ sql);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + nfe2) then ForceDirectories(ExtractFilePath(Application.ExeName)+ nfe2);
if not DirectoryExists(ExtractFilePath(Application.ExeName) + bro) then ForceDirectories(ExtractFilePath(Application.ExeName)+ bro);

end;
GOSTEI 0
POSTAR