You are not logged in.
Pages: 1
Sry again for that lack of RTFM, Arnaud.
Finally, at the stage where I am, using mORMot in my project is like trying to kill a fly with a warhammer.
Your documentation is good but far too heavy for what I do with your framework.
Hi Arnaud,
C'est reparti pour un tour.
My trainee has left my project with a huge memory leak, he tried to get rid of it but didn't succeed.
My first thought was he must have done something wrong.
But he did not.
in fact , it seems that there are leaks on query text (?) when query is not cached.
I can reproduce the phenomenon using this code :
Var
rowsync : ISQLDBRows;
CnxBDDProp: TSQLDBSQLite3ConnectionProperties;
Begin
CnxBDDProp := TSQLDBSQLite3ConnectionProperties.Create(Configuration.Options['BDD'].AsString, '', '', '');
rowsync := CnxBDDProp.Execute('SELECT ID FROM ' + table + ' WHERE ID = ' + IntToStr(i), []); // this is leaking
rowsync := CnxBDDProp.Execute('SELECT ID FROM ' + table + ' WHERE ID = ?' , [i ]); // this is not leaking
CnxBDDProp.Free;
End;
Here are other examples of query in leaking and not leaking version :
// LEAKING
row := CnxBDDProp.Execute('SELECT name FROM sqlite_master WHERE type =''table'' AND name like ''Libelle\_%'' ESCAPE ''\''', []);
row := CnxBDDProp.Execute('SELECT name FROM sqlite_master WHERE type ="table" ', []);
// NOT LEAKING
row := CnxBDDProp.Execute('SELECT ''Libelle_FR'' as name', []);
row := CnxBDDProp.Execute('SELECT name FROM sqlite_master', []);
As you can see , it seems that if query contains a ? or does'nt contains WHERE , it's cached and not leaking. In the other case, it leaks.
(tested with today's NightlyBuild)
Any idea what' wrong ?
TY !
Hi Arnaud,
All is OK now using Execute() and ExecuteNoResult() .
Sry for the inconvenience ....
All tests in TestSQL3 are OK, good news for you, bad for me
Couldn't it be linked to the static SQLite 3 feature ?
The procedures performing the leak are apparently dead simple :
Procedure TTraducteurSIRWEB.AjouteLibellePrg(pIDLibelle: Integer; ConnexionBDD: TSQLDBSQLite3Connection);
Var
stmt : TSQLDBSQLite3Statement;
id : Integer;
IdPrgm: Integer;
Begin
stmt := TSQLDBSQLite3Statement.Create(ConnexionBDD);
stmt.Execute('SELECT ID FROM LibellesProgramme WHERE Dest = ' + IntToStr(pIDLibelle) + ' AND SOURCE =' + IntToStr(FProgramme.GetID) + ';', false);
stmt.step();
id := stmt.ColumnInt('ID');
If id = 0 Then
Begin
stmt.Execute('INSERT INTO LibellesProgramme VALUES(null,' + IntToStr(pIDLibelle) + ',' + IntToStr(FProgramme.GetID) + ');', false);
End;
stmt.free;
End;
Procedure TTraducteurSIRWEB.AjouteCorres(pIDLibelle: Integer; ConnexionBDD: TSQLDBSQLite3Connection);
Var
stmt: TSQLDBSQLite3Statement;
Begin
stmt := TSQLDBSQLite3Statement.Create(ConnexionBDD);
stmt.Execute('INSERT INTO Corres VALUES(null,' + IntToStr(pIDLibelle) + ');', true);
stmt.step;
stmt.Free;
End;
I'm using mORMot 1.18 with Delphi XE2 and I *seem* to have huge memory leaks :
Each query I perform on the database seems to leak a memory block.
Tracing with FASTMM4 gives me the following log :
A memory block has been leaked. The size is: 64164
This block was allocated by thread 0x16A4, and the stack trace (return addresses) at the time was:
404B22 [System][@GetMem$qqri]
57EDEC [SynSQLite3Static.pas][SynSQLite3Static][malloc$qui][250]
58230F [SynSQLite3Static]
582A93 [SynSQLite3Static][sqlite3_memory_highwater$qi]
5D3280 [SynSQLite3Static][sqlite3_shutdown$qv]
5D4D6D [SynSQLite3Static][sqlite3_errmsg$qui]
5D4DE4 [SynSQLite3Static][sqlite3_open$qpcrui]
4FF6EF [SynSQLite3.pas][SynSQLite3][TSQLDatabase.DBOpen$qqrv][3406]
4FE32D [SynSQLite3.pas][SynSQLite3][TSQLDatabase.$bctr$qqrx20System.UnicodeStringx31System.%AnsiStringT$us$i65001$%i][2967]
51171D [SynDBSQLite3.pas][SynDBSQLite3][TSQLDBSQLite3Connection.Connect$qqrv][393]
50FD59 [SynDB.pas][SynDB][TSQLDBStatement.Prepare$qqrx31System.%AnsiStringT$us$i65001$%o][5497]
The block is currently used for an object of class: Unknown
The allocation number is: 4439
Current memory dump of 256 bytes starting at pointer address 7EE11570:
00 FA 00 00 00 00 00 00 00 00 00 00 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 78 15 E1 7E 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
. ú . . . . . . . . . . € € € € € € € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € € € € € € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € € € € € € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € € € € € € € € € € € € € € € € € € €
€ € € € € € € € x . á ~ € € € € € € € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € € € € € € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € € € € € € € € € € € € € € € € € € €
€ € € € € € € € € € € € € € € € € € € € € € € € € € € € € € € €
I've got a lot of these leak blocks reported, with various size.
I think I've checked all my objects creation and liberation, so I don't think that the problem is in my code. I've tested the last (today 01/04/14) trunk source of mORMot
Any ideas what's wrong ?
Ty
Hello,
It works well now, thank you very much Arnaud !
As I switched several times between 1.17 and 1.18 I must have left an older version of these obj in the 1.18 folder.
Désolé pour le dérangement
Hello,
I'm trying to upgrade a project using mORMot 1.17 to 1.18.
mORMot folders are referenced in the search path (? en francais : chemin de recherche) of the project
System is : Windows 7 64 bits ; Delphi and project in 32 bits.
I performed the following :
replaced uses clause with SQLite3Commons with mORmot
replaced uses clause with SynSQLite3 with SynSQLite3Static and add it on top of uses clause (in order initialization is called)
copied sqlite3ft3.obj in mORMot\SQLite3 folder
replaced uses clause with SQLite3 with mORmotSQLite3
I didn't touch anything else in the project.
Now , the executable crashes on CreateMissingTables() call.
Here are some screens of the call stack :
Any idea what's wrong ?
Dear Arnaud,
In the version i'm actually using in production (version 1.17), this function seems to be nowhere :
I'll try to plan integration of version 1.18 in my project ...
Hello,
As far as I understand everything I read about mORMot and SQLite, mORMot extended the NOCASE collation by its own SYSTEMNOCASE collation, and is used as the default collation.
My problem is that I need to perform a case sensitive comparison so I tried the following :
type
TSQLibelleDev = class(TSQLRecord)
protected
class procedure InternalRegisterCustomProperties(Props: TSQLRecordProperties); override;
....
class procedure TSQLLibelleDev.InternalRegisterCustomProperties(Props: TSQLRecordProperties);
begin
Props.SetCustomCollationForAllRawUTF8('BINARY');
end;
Unfortunately, SetCustomCollationForAllRawUTF8 doesn't seem to exist any more.
How can I perform a case sensitive comparison ( equality comparison, not LIKE comparison) ?
Ty
Hello,
For personal and professional purpose , I would like to create a layer for handling Advantage Database Server in mORMot.
I know I must use SynDBNexusDB.pas as a start point for it, but, as Advantage Database Server already offers a set of Delphi classes (TAdsConnection, TADsQuery ...) to use the database, I wonder if just creating wrappers between ADS objects and mORMot objects (example : TAdsDataset -> ESQLDBDataset ) is the proper and better way to do it.
Any suggestions ?
It works great now !
I' m just at the beginning of the integration of your framework in my company programs, and I would have been worried to abandon it because for that issue !
Keep on doing such a great job, mORMot is really a great piece of software.
I plan to develop an Advantage database layer for your framework once I'll master the main concepts.
Ty very much.
Hello,
I'm facing a very strange problem : the script I use to compile my datasnap server (XE2) produce "corrupted' executable since I added SynDBSQLite3 in reference.
When I compile from IDE, all is OK. When I compile using my script ( msbuild /v:d %DPROJ% /target:MakeAll /p:config=Debug;DCC_ExeOutput="%DESTPATH%" ) , my DataSnap server is 1,5 mb less (SQlite library size ?) and executable hangs on an EInsufficientRTTI exception message on startup.
I compile 32 bits programs on Windows 7 64 bits.
Any clue ?
Ty by advance
Pages: 1