Re: [fpc-pascal] fpWeb: How can I use heaptrc in standalone mode?

2018-05-06 Thread Marcos Douglas B. Santos
On Sun, May 6, 2018 at 6:26 PM, Marcos Douglas B. Santos  
wrote:
> On Sun, May 6, 2018 at 6:05 PM, leledumbo via fpc-pascal
>  wrote:
>>> Create a call that calls Application.Terminate.
>>
>> I just call DumpHeap(false); instead
>
> Where is this function or method? Could you give so more information
> how is this works with heaptrc?

I saw that it's part or webutil unit... it is not the case here. But thanks.

> About my test, do you have the same memleak?

Could you please do the same test?

Regards,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpWeb: How can I use heaptrc in standalone mode?

2018-05-06 Thread Marcos Douglas B. Santos
On Sun, May 6, 2018 at 6:05 PM, leledumbo via fpc-pascal
 wrote:
>> Create a call that calls Application.Terminate.
>
> I just call DumpHeap(false); instead

Where is this function or method? Could you give so more information
how is this works with heaptrc?

About my test, do you have the same memleak?

Thanks.

Best,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Sven Barth via fpc-pascal

Am 05.05.2018 um 19:53 schrieb Tomas Hajny:

On Sat, May 5, 2018 19:23, Sven Barth via fpc-pascal wrote:


Hi Sven,

  .
  .

(e.g. "MyUnits" or "FCL.XML" or "FCL.Web.Base"). Like with all similar
-F parameters -FN only takes a single value, but can be specified
multiple times.

  .
  .

I'm not sure what are 'all similar -F parameters', but many -F parameters
allow multiple semicolon separated values.


Done in r38939. :)

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] detecting recursive loops

2018-05-06 Thread leledumbo via fpc-pascal
> Any ideas how to identify potential unintentional loops?

That depends on your design. Is it intended that the 3 procedures can call
each other, directly or indirectly? If no, then things are a lot easier. You
can just put on the currently entered procedure name to a map shared by the
3 (or just make it global) and on start of each procedure, you check whether
the current procedure is in the map already or not. If yes, then the current
call stack has formed a recursion.



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpWeb: How can I use heaptrc in standalone mode?

2018-05-06 Thread leledumbo via fpc-pascal
> Create a call that calls Application.Terminate. 

I just call DumpHeap(false); instead



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpWeb: How can I use heaptrc in standalone mode?

2018-05-06 Thread Marcos Douglas B. Santos
On Sat, May 5, 2018 at 11:51 AM, Michael Van Canneyt
 wrote:
>
>
> On Sat, 5 May 2018, Marcos Douglas B. Santos wrote:
>
>> I'm using fpWeb in standalone mode (fphttpapp unit) to develop and debug.
>> I would like to see the heaptrc log in the end, as we can do in normal
>> desktop applications.
>>
>> So, in one route I create an object and don't release it to simulate a
>> memleak.
>>
>> I've tried to set heaptrc.SetHeapTraceOutput('log.txt'). The app
>> creates the file, but there is no log there.
>
>
> This is definitely necessary.
>
>>
>> I've tried to execute using F9 IDE and by command-line too.
>> I think the problem is that we need to kill the server (Ctrl+C) and,
>> because that, no log is created.
>>
>> So, how can I see the log?
>
>
> Create a call that calls Application.Terminate.

Michael,

I believe there is a memleak but I couldn't found.
I've just created a route that calls Application.Terminate and I got this:

===BEGIN===
Heap dump by heaptrc unit
387 memory blocks allocated : 18658/19944
385 memory blocks freed : 18626/19912
2 unfreed memory blocks : 32
True heap size : 196608 (96 used in System startup)
True free heap : 196320
Should be : 196352
Call trace for block $034CA470 size 16
  $0042D3C1
  $00438926
  $004375AA
  $00437268
  $004265FB
  $BAADF00D
  $BAADF00D
  $BAADF00D
Call trace for block $034CA410 size 16
  $0042CE3B
  $0042D3C1
  $00438926
  $004375AA
  $00437268
  $004265FB
  $BAADF00D
  $BAADF00D

===END===


Here is my test program:

===BEGIN===
program demo;

{$define STANDALONE}

uses
  SysUtils,
  httpdefs, httproute,
{$ifdef STANDALONE}
  fphttpapp,
{$endif}
{$ifdef FCGI}
  fpfcgi,
{$endif}
  IniFiles;

{$ifdef STANDALONE}
procedure TerminateCallBack({%H-}ARequest: TRequest; {%H-}AResponse: TResponse);
begin
  Application.Terminate;
end;

procedure ConfigureStandalone;
begin
  heaptrc.SetHeapTraceOutput('log.txt');
  heaptrc.GlobalSkipIfNoLeaks := True;
  heaptrc.HaltOnError := False;
  with TIniFile.Create('demo.ini') do
  try
Application.Port := ReadInteger('Standalone','Port',8080);
  finally
Free;
  end;
  HTTPRouter.RegisterRoute('quit', rmAll, @TerminateCallBack, True);
end;
{$endif}

begin
{$ifdef STANDALONE}
  ConfigureStandalone;
{$endif}
  Application.Initialize;
  Application.Run;
end.

===END===

My environment is:  Lazarus 1.8.3 r57764 FPC 3.0.4 i386-win32-win32/win64

Best regards,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Cross compiling: Win 32 to 64

2018-05-06 Thread Marcos Douglas B. Santos
Sorry guys, I've just forgot to setup in Lazarus, Config and Target this:
 -Twin64   _AND_  -Px86_64 parameters.

In the first time, I just set -Twin32 but -P stayed "(default)":|
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Cross compiling: Win 32 to 64

2018-05-06 Thread Marcos Douglas B. Santos
I have a script for a long time that I use to compile FPC from sources.
Today I'm configuring a new machine and I would like to use this
script to configure FPC and Lazarus — I have another script for
Lazarus as well.

I've compiled FPC with no errors using this script. I use
`crossinstall` too. Again, no errors.

You can see it here (today I changed it a little just to simplify) -->
https://github.com/mdbs99/fp-scripts/blob/master/fpc-make.bat

So, my issue is that:
When I open Lazarus and setup from Win32 to Win64, the IDE says me:
"The current FPC has no config file. It will probably miss some units.
Check your installation of fpc."

After the installation, I can see these directories:
1. /bin/i386-win32
2. /units/i386-win32
3. /units/x86_64-win64

Should I have the same `/bin/x86_64-win64` directory after the compilation?
What am I missing here?

Best,
Marcos Douglas

PS. I know that there are others ways to install, like fpcup|deluxe,
but I would like to use my script because could be just a simple
change that I forgot...
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespacesy

2018-05-06 Thread Marco van de Voort
In our previous episode, Marcos Douglas B. Santos said:
>  wrote:
> > [...]
> >
> > In FPC we currently don't use dotted unit names much, but maybe that will
> > change in the future.
> 
> Would be good if all units could be prefixed to make a pattern, like
> `fpc.web, fpc.xml, ...` but I know that we need to maintain the
> compatibility with Delphi using the same names...

Yes. And you don't want to keep long lists of all prefixes that you want to
have, so I think it is more for exceptions where there are clashes than for
mass transition to this scheme. To be honest I always found it annoying in
Delphi, and use old names and prefixes as much as possible.

But it does resolves problems like Lazarus currently (afaik) not installing FV
because units conflict. 

E.g. The conflicting units can get a prefix lcl. and
Lazarus automatically adds the prefix parameter for projects that use LCL.

Similarly for other packages that have very common names.

Only projects that really use both such packages will have to use the longer
form.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Marcos Douglas B. Santos
On Sun, May 6, 2018 at 10:45 AM, Vojtěch Čihák  wrote:
> i,
>
> LCLIntf, LCLProc, LCLType isn't enough? I will use dotted units only if
> there will be absolutely no other way around.

There are many others without LCL prefix...

> I believe it can be useful but I don't think it's "must have" (when I don't
> consider Delphi compat.).

I've said "would..." and "could..."

Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Vojtěch Čihák

i,
 
LCLIntf, LCLProc, LCLType isn't enough? I will use dotted units only if there 
will be absolutely no other way around.
I believe it can be useful but I don't think it's "must have" (when I don't 
consider Delphi compat.). 
 
V.
__

Od: "Marcos Douglas B. Santos" 
Komu: FPC-Pascal users discussions 
Datum: 06.05.2018 15:34
Předmět: Re: [fpc-pascal] Feature announcement: default namespaces


On Sun, May 6, 2018 at 4:40 AM, Sven Barth via fpc-pascal
 wrote:
> [...]
>
> In FPC we currently don't use dotted unit names much, but maybe that will
> change in the future.

Would be good if all units could be prefixed to make a pattern, like
`fpc.web, fpc.xml, ...` but I know that we need to maintain the
compatibility with Delphi using the same names...
However, Lazarus could do that — we just need a replace in the code.

By the way, good work!

Best,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal 

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Marcos Douglas B. Santos
On Sun, May 6, 2018 at 4:40 AM, Sven Barth via fpc-pascal
 wrote:
> [...]
>
> In FPC we currently don't use dotted unit names much, but maybe that will
> change in the future.

Would be good if all units could be prefixed to make a pattern, like
`fpc.web, fpc.xml, ...` but I know that we need to maintain the
compatibility with Delphi using the same names...
However, Lazarus could do that — we just need a replace in the code.

By the way, good work!

Best,
Marcos Douglas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Marco van de Voort
In our previous episode, Sven Barth via fpc-pascal said:
> 
> In FPC we currently don't use dotted unit names much, but maybe that will
> change in the future.

Afaik  FV and LCL have conflicts.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] detecting recursive loops

2018-05-06 Thread Mark Morgan Lloyd

On 05/05/18 21:15, James Richters wrote:

I'm having an issue with one of my programs that I suspect is being caused by a 
recursive loop... in simplified form... something like this:
Procedure Proc1;Begin   Proc2;End;Procedure Proc2;Begin   Proc1;End;
I ended up getting a runtime error and the report showed something like above, 
where I had a loop of the same 3 procedures calling each other over and over in 
sequence in a loop before the actual error.   Unfortunately I didn't take down 
all the information because I thought I could make it happen again.. but I 
haven't had the runtime error again... however under certain conditions 
sequences that normally happen very fast become very slow and I suspect it 
somehow is getting into this recursive loop again.
It's a very large very complicated program and trying figure out where this is 
happening is becoming quite a challenge.   I was wondering if there is some 
method of detecting these recursive loops, either during compilation, or is 
there some option that would force a runtime error if a loop of procedures 
happened.
Any ideas how to identify potential unintentional loops?


I occasionally put entry/exit counters on functions that I suspect are 
going to be a problem, InterlockedIncrement() etc. You can obviously 
have your code check that as a verification of sanity, or pick up a haig 
value using a conditional breakpoint.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Marco van de Voort
In our previous episode, Mattias Gaertner said:
> He meant:
> If you use units with namespaces and you can't use the -FN option, then
> it becomes cumbersome to write them. Then a unit directive would be
> nice to have.

Yes, but both the directive and the uses would be a modification anyway.

I can imagine that if you have an includefile with defines, that it is
iuseful.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Ryan Joseph


> On May 6, 2018, at 2:40 PM, Sven Barth via fpc-pascal 
>  wrote:
> 
> The namespaces in Object Pascal are merely a convenience thing. E.g. Delphi 
> prefixed many of the existing units (like SysUtils became System.SysUtils, 
> Windows became WinApi.Windows and Forms became VCL.Forms (or so)). They did 
> this so that FireMonkey units can share unit names with the VCL (e.g. 
> FMX.Forms). But to keep backwards compatibility with old code Delphi projects 
> have by default their default namespace list set to something like "System, 
> WinApi, VCL" so that such code continues to compile. 
> 

So I could use this feature if I used dotted file names like Utils.Foo.pas? I 
never thought of doing that before so this is al news to me. 

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Sven Barth via fpc-pascal
Tomas Hajny  schrieb am Sa., 5. Mai 2018, 19:52:

> On Sat, May 5, 2018 19:23, Sven Barth via fpc-pascal wrote:
>
>
> Hi Sven,
>
>  .
>  .
> > (e.g. "MyUnits" or "FCL.XML" or "FCL.Web.Base"). Like with all similar
> > -F parameters -FN only takes a single value, but can be specified
> > multiple times.
>  .
>  .
>
> I'm not sure what are 'all similar -F parameters', but many -F parameters
> allow multiple semicolon separated values.
>

Then that's something I'll have to add then as well ;)

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Sven Barth via fpc-pascal
Ryan Joseph  schrieb am So., 6. Mai 2018, 09:16:

>
>
> > On May 6, 2018, at 1:46 PM, Mattias Gaertner 
> wrote:
> >
> > He meant:
> > If you use units with namespaces and you can't use the -FN option, then
> > it becomes cumbersome to write them. Then a unit directive would be
> > nice to have.
>
> But does FPC have actual namespaces besides prefixing unit names? What
> exactly are "units with namespaces”?
>

They are also named "dotted units" and as I wrote in y announcement mail
Object Pascal doesn't have namespaces in the sense of languages like C#,
C++ or Java that allow for deep hierarchies and such.
The namespaces in Object Pascal are merely a convenience thing. E.g. Delphi
prefixed many of the existing units (like SysUtils became System.SysUtils,
Windows became WinApi.Windows and Forms became VCL.Forms (or so)). They did
this so that FireMonkey units can share unit names with the VCL (e.g.
FMX.Forms). But to keep backwards compatibility with old code Delphi
projects have by default their default namespace list set to something like
"System, WinApi, VCL" so that such code continues to compile.

In FPC we currently don't use dotted unit names much, but maybe that will
change in the future.

Regards,
Sven

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Sven Barth via fpc-pascal
Ben Grasset  schrieb am So., 6. Mai 2018, 03:16:

> Cool I guess. Kind of seems not very important at all though. FPC lacks
> compatibility with current Delphi in various other far more significant
> areas...
>

It was something that was relatively easy to implement and what some people
complained about that we don't have.
Also pas2js already implemented it which bothered me a bit :P

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Ryan Joseph


> On May 6, 2018, at 1:46 PM, Mattias Gaertner  
> wrote:
> 
> He meant:
> If you use units with namespaces and you can't use the -FN option, then
> it becomes cumbersome to write them. Then a unit directive would be
> nice to have.

But does FPC have actual namespaces besides prefixing unit names? What exactly 
are "units with namespaces”?

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Mattias Gaertner
On Sun, 6 May 2018 09:11:23 +0700
Ryan Joseph  wrote:

> > On May 6, 2018, at 12:23 AM, Sven Barth via fpc-pascal 
> >  wrote:
> > 
> > For some users it might be cumbersome however to write the complete names 
> > (even though their IDE of choice might support them here) or maybe they 
> > have different sets of units with same names and interfaces, but different 
> > namespaces (e.g. ProductX and ProductY which contain wrappers units for the 
> > 3rd party products X and Y with a common interface). Of course in the 
> > latter case these can be switched using ifdefs or some creative usage of 
> > macros, but that can be done simpler.  
> 
> I don’t understand what this is for because “namespaces” in FPC are optional 
> anyways right? I’ve only used them to resolve name conflicts but if they’re 
> optional then doesn’t that implicitly imply they're default also? Maybe a 
> concrete example would help to explain.

He meant:
If you use units with namespaces and you can't use the -FN option, then
it becomes cumbersome to write them. Then a unit directive would be
nice to have.

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal