#1 Re: mORMot 1 » LogView: Issue with TTimer » 2015-09-24 19:22:23

RemoteLog is working now.
Thank you very much for you attendance and support.

#2 Re: mORMot 1 » LogView: Issue with TTimer » 2015-09-24 17:00:23

Hi Arnaud,

I simply compile LogView.dpr Win32 VCL application with Delphi 2010/Windows 7x64.

And I got same issue compiling with Delphi 7.
Other «mORMothers» (I call it because they are mORMot Users - this make sense with my regional context) have same result on different computers.

This issue still remaining with the updated git repository (b010f9e6 - 2015-09-24 16:20).
I think the timer is never enabled now (or only once in procedure btnServerLaunchClick).

#3 mORMot 1 » LogView: Issue with TTimer » 2015-09-23 20:46:39

syagrius
Replies: 4

Hello,

I think I found an issue in project LogView.dpr of Sample 11 (Exception logging).

In procedure ReceivedOne() you try to Enable a timer using this line

procedure TMainLogView.ReceivedOne(const Text: RawUTF8);
begin
   // 8<----8<----8<----8<--
   tmrRefresh.Enabled := true; // MUCH faster than Synchronize() to use a timer
end;

But the timer event is not fired.
I think it's because you are not in situation where: GetCurrentThreadId = MainThreadId
                                                     
How to reproduce:
1 - Open and run LogView.dpr
2 - Click on [Server Launch]
3 - Test the connection using  RemoteLogginTest.dpr
4 - The event timer is not fired (or fired only once)

Tested under Delphi 2010/Win7x64

#4 mORMot 1 » Delphi 5 compilation failure » 2014-08-17 16:18:58

syagrius
Replies: 1

Hi,

I found an issue under Delphi 5.

Class definition of TFakeWriterStream is in the wrong section (NOVARIANTS).
I think it should be located after {$endif DELPHI2010} and before {$ifndef NOVARIANTS} (line 24140) like this:

{$endif ISDELPHI2010}
type
  /// a fake TStream, which will just count the number of bytes written
  TFakeWriterStream = class(TStream)
  public
    function Read(var Buffer; Count: Longint): Longint; override;
    function Write(const Buffer; Count: Longint): Longint; override;
    function Seek(Offset: Longint; Origin: Word): Longint; override;
  end;

function TFakeWriterStream.Read(var Buffer; Count: Longint): Longint;
begin // do nothing
  result := Count;
end;

function TFakeWriterStream.Write(const Buffer; Count: Longint): Longint;
begin // do nothing
  result := Count;
end;

function TFakeWriterStream.Seek(Offset: Longint; Origin: Word): Longint;
begin
  result := Offset;
end;

{$ifndef NOVARIANTS}

#5 Re: mORMot 1 » Question about Delphi 5 support » 2014-08-03 14:14:12

Thank you so much for the patch.
I'm now able to use common functions on both side!

I'm extremely excited about the possibility of being able to use you CrossPlatForm approach.
However I would agree that supporting Delphi 5 is not the future for a young mORMot - (FPC/Lazarus/CodeTyphon probably does).

I still want to use mORMot on server side.
I found MsgConnect written by Eugene Mayevski (Eldos.com).

MsgConnect is open-source and free for non commercial use.
(but you need to purchase a commercial license if you are going to charge your customers)

MsgConnect supports:
- Synchronous or Asynchronous communication, callback are available
- You can switch from TCP, UDP, HTTP, MMF (Memory Mapped File) for communication
- I use MMF since I would not want to add another TCP implemetention (MsgConnect is relying on Winsock.pas)
- User authentication is available
- I only tried Java and Delphi 5 but there are different port to Linux, WinCE, Android and .Net (written in pure C++, C#)
- There are some MsgConnect articles here

Of course you probably know this library.
I just posting details for all users.

All this to say that I am integrating MsgConnect as transport layer.
And I use RecordLoadJSON / RecordSaveJSON for Marshalling on both side.
Initial experiments and stress-test have proven very successful and very positive **

So the lack of support for D5 is not an issue for me.


** No mORMot were harmed during testing.

#6 Re: mORMot 1 » Question about Delphi 5 support » 2014-08-01 11:37:25

I took a look at CrossPlatform.pas.mustache + SAD + «27 - CrossPlatform Clients»

Delphi has no TInvokeableVariantType so SynCrossPlatformJSON.pas will not compile.

And I am a little bit confused about the SAD.
Chapter 23.1.3 and Chapter 24.2.2 suggest that SynCommons.pas is compatible with Delphi 5.
But it refuses to compile.

I must admit that I do not have enough knowledge to see what to do - For the moment at least.

Of course I stay tuned for more details in the further days.
Thank you very much indeed.

#7 mORMot 1 » Question about Delphi 5 support » 2014-07-31 10:22:35

syagrius
Replies: 4

Hello,

I plan to interface an ancient application written using Delphi 5.

I would like to connect this old application to a new server part.
Server is an interface based services (like Sample 14) written using Delphi 2010 + latest mORMot.

I tried to wrote a sample client (D5) application but I simply cannot compile my project.
Especially SynCommons.pas.

How to reproduce:
- Create a new project in Dephi 5.
- Add SynCommons to the uses.
- Compilation failed.

So chapter «Implemented Tests» of SAD 1.18 says that «Delphi 5 is supported for a limited scope including SynCommons and SynDB»

Did I missing anything or D5 support is dropped ?

#8 Re: mORMot 1 » Using examples » 2014-07-26 22:59:05

Hi Abed,

For example 18 simply try to open MyApp.html in your browser.
For example 19 open index.html

#9 Re: mORMot 1 » Possible memory leak with RecordLoadJSON using enhanced RTTI » 2014-07-07 13:35:46

Everything is working now.
About the delay it was perfect.

Thank you!

#10 Re: mORMot 1 » Possible memory leak with RecordLoadJSON using enhanced RTTI » 2014-07-07 12:42:51

I wrote a simple DPR to reproduce the memory report.
Tested under different computers with same result.

jsonleak.dpr

program jsonleak;

{$APPTYPE CONSOLE}

uses
  FastMM4,
  SynCommons;

type
  TBookRecord = packed record
    Name: string;
    author: record
      first_name:string;
      last_name:string;
    end;
  end;

var
  Json:  RawUTF8;
  B:  TBookRecord;

begin
  ReportMemoryLeaksOnShutdown:=True;

  Json :='{ "name": "How to tame a mormot", "author": { "first_name": "Bob", "last_name": "White" } }';
  RecordLoadJSON(B,@Json[1],TypeInfo(TBookRecord));
end.

#11 Re: mORMot 1 » Possible memory leak with RecordLoadJSON using enhanced RTTI » 2014-07-06 18:51:54

I think your can reproduce my issue.

1 - open TestSQL3.dpr
2 - comment the call to SQLite3ConsoleTests()
3 - and add my code snippet
For instance

  // SQLite3ConsoleTests;
  Json :='{ "name": "Book the First", "author": { "first_name": "Bob", "last_name": "White" } }';
  RecordLoadJSON(B,@Json[1],TypeInfo(TBookRecord));

4 - Run, You got a memory leak
5 - Reactivate the call to SQLite3ConsoleTests()
6 - Run, No memory leak!

I have been noticing another thing.
I have no leak after a simple call to RecordSaveJSON(), but only if TypeInfo points to a record without nested record

  // SQLite3ConsoleTests;   
  RecordSaveJSON(g,TypeInfo(TGUID)); // Calling RecordSaveJSON() *BEFORE* RecordLoadJSON() will remove the leak
  Json :='{ "name": "Book the First", "author": { "first_name": "Bob", "last_name": "White" } }';
  RecordLoadJSON(B,@Json[1],TypeInfo(TBookRecord));

The code above is working.



  // SQLite3ConsoleTests;   
  RecordSaveJSON(B,TypeInfo(TRecordWithNestedRecord)); // No effect
  Json :='{ "name": "Book the First", "author": { "first_name": "Bob", "last_name": "White" } }';
  RecordLoadJSON(B,@Json[1],TypeInfo(TBookRecord));

Memory leak still remain.

#12 Re: mORMot 1 » Possible memory leak with RecordLoadJSON using enhanced RTTI » 2014-07-06 17:52:33

Thank you very much for the speed and clarity of your reply.
I updated my mORMot (also thank you about the ingenious idea of using git now).

I noticed that TestSQL3 is working without any memory leak.

But I still have a leak after moving ReportMemoryLeaksOnShutdown sooner.
I also tried Eurekalog with the same report.

There is probably something wrong in my code.
I will conduct an extensive search about my project.

#13 mORMot 1 » Possible memory leak with RecordLoadJSON using enhanced RTTI » 2014-07-06 14:53:44

syagrius
Replies: 7

Hi there!

I'm new to this forum.
And mOMRot is the first animal I try to tame.

I read SAD and took a look at “25 - JSON Performance” sample.

I try to unmarshalling a JSON string using RecordLoadJSON.

The JSON looks like this:

{	
	"name": "Book the First",
	"author": {
		"first_name": "Bob",
		"last_name": "White"
	}
}

I use Delphi 2010 so mORMot will automatically use enhanced RTTI information (using a TJSONCustomParserFromRTTI automatically).

This is great and everything is OK.
But FastMM4 report a memory leak.

My code to reproduce:

type
  TBookRecord = packed record
    name: string;
    author: record
      first_name:string;
      last_name:string;
    end;
  end;
var
  B:  TBookRecord;
  Json:  RawUTF8;
begin
  ReportMemoryLeaksOnShutdown:=true;
  Json :='{ "name": "Book the First", "author": { "first_name": "Bob", "last_name": "White" } }';
  RecordLoadJSON(B,@Json[1],TypeInfo(TBookRecord));
end;

Maybe I'm wrong or I forget to release something.
But I think an instance of TJSONCustomParserFromRTTI is not released.

For instance in SynCommons.pas, in function TJSONCustomParsers.TryToGetFromRTTI()

Reg.RecordCustomParser := TJSONCustomParserFromRTTI.Create(Reg.RecordTypeInfo,RegRoot);

Did I miss anything?

Board footer

Powered by FluxBB