|
<< Click to Display Table of Contents >> Navigation: Telegram > 2018 > 11 > 08 > Telegram_2018-11-08T18 |
2018-11-08T18:10:13
I think there is a problem somewhere in your code which causes that
2018-11-08T18:10:26
FastMM doesn't have any known bugs like that
2018-11-08T18:10:35
the same for IW code
2018-11-08T18:11:24
I suggest you to turn off debug info in FastMM4 code (not required but you don't want to debug FastMM code). To do that, check comments in FastMM4.pas file
2018-11-08T18:11:38
then try to debug your own code when a session is being destroyed
2018-11-08T18:12:30
Maybe you are trying to free something twice. It is a *very* common mistake that can go unoticed even to experienced developers
2018-11-08T18:13:14
don't create any new thread on the servercontroller, unless you have a good reason for that.... It is not necessary
2018-11-08T18:14:06
I see you have several arrays of controls in your user session
2018-11-08T18:14:20
how do you create and destroy them? Who is the owner?
2018-11-08T18:16:21
all with \if\ - so, \Maybe you are trying to free something twice\ - disappears?
2018-11-08T18:16:52
How can I do this?
2018-11-08T18:18:29
open your file type: link FastMM4Options.inc
2018-11-08T18:18:46
look for NoDebugInfo
2018-11-08T18:19:05
you will find something like:
{.$define NoDebugInfo}
2018-11-08T18:19:24
the DOT . in front of the dollar sign disables it, right?
2018-11-08T18:19:26
remove the dot
2018-11-08T18:19:30
so it becomes
2018-11-08T18:19:32
{$define NoDebugInfo}
2018-11-08T18:19:36
rebuild your app
2018-11-08T18:20:33
then debug information for FastMM code will not be generated, so you can step into your code without going through FastMM code
2018-11-08T18:21:17
how do you create your labels, for instance, which are referenced in one of those arrays?
2018-11-08T18:21:45
All dynamicly
2018-11-08T18:22:12
yes, but who is the owner?
you probably have something like TIWLabel.Create();
2018-11-08T18:22:14
right?
2018-11-08T18:24:51
all nil with Parents
2018-11-08T18:25:23
ok, so you are responsible for its destruction. You should destroy them with something like:
2018-11-08T18:25:25
var
i: Integer;
LControl: TIWControl;
begin
for i := Low(SetRFLBL) to High(SetRFLBL) do
begin
LControl := SetRFLBL[i];
if Assigned(LControl) then
begin
LControl.Free;
SetRFLBL[i] := nil;
end;
end;
end;
2018-11-08T18:25:42
taking for example your SetRFLBL array which contains TIWLabel instances
2018-11-08T18:27:07
First Parent Control depends of IWForm Region
2018-11-08T18:27:32
OK... looks correct
2018-11-08T18:27:33
Ok, I'll try
2018-11-08T18:28:03
the code I wrote above... use it BEFORE changing the array length
2018-11-08T18:28:09
or clearing it
2018-11-08T18:29:04
do it right after the FileExists() lines above
2018-11-08T18:29:57
ye I undarstand, thanks??
2018-11-08T18:30:06
??
2018-11-08T18:32:09
I'll take an hour - I have already begun to make a thread - I want to see what happens?? ... write off the result - something interesting was done))) Everything that you wrote about then I will do ok??
2018-11-08T18:32:59
??
2018-11-08T18:35:17
no problem if you need a thread to do something you need, but have in mind that you are creating one thread per session with that code. This comes with a cost
2018-11-08T18:40:12
yes, but threads clean memory leaks well - I use a similar approach in my bots and it works fine... I need to use specific thread for IW? Or that's all rigth?
2018-11-08T18:41:12
Last time I can't do that because it was AFlag exception
2018-11-08T18:42:09
I want to deal with it??
2018-11-08T18:43:34
VCL is not thread safe (not talking about IW code, but Delphi VCL code)
2018-11-08T18:43:44
creating components in threads is not something you should do
2018-11-08T18:44:30
it will always work in your dev environment, with a single user. But will always fail in your prod enviroment, withouth any warning
2018-11-08T18:47:05
ok, let me finish the experiment Alexandre??At least I will write how to do it is not necessary??
2018-11-08T18:47:33
ok
2018-11-08T18:49:08
IW creates their components in threads, but IW code protects itself from concurrent access. <- just a little context
2018-11-08T18:49:58
??