dkprojektai
Members-
Content Count
61 -
Joined
-
Last visited
Everything posted by dkprojektai
-
Image pointer and buffer size
dkprojektai replied to dkprojektai's topic in Algorithms, Data Structures and Class Design
That is what I wanted and it helped. Thanks Remy Lebeau -
Image pointer and buffer size
dkprojektai replied to dkprojektai's topic in Algorithms, Data Structures and Class Design
I have Bitmap and want to pass it this function function ReadFromMemFile(hEngine: TENGINE; pBuffer: Pointer; bufferSize: Integer): TRESULT; -
Image pointer and buffer size
dkprojektai replied to dkprojektai's topic in Algorithms, Data Structures and Class Design
I have Tbitmap I need: * pBuffer - Pointer to memory buffer which contain image file data * bufferSize - size of memory buffer in bytes -
Image pointer and buffer size
dkprojektai replied to dkprojektai's topic in Algorithms, Data Structures and Class Design
thanks, but for me is too complicated. Could you write an example? -
Hello, I have a memory leak (EurekaLog): Memory Leak: Type=UnicodeString: Ref count - 1, Content: "Archive info"; Total size=78; Count=3; It happens not every time. It found in: var result_text: IRecognitionResult; procedure TWorkerThread.Execute; begin ... OtlParallel.Parallel.For(0, 20,1).NumTasks(6).Execute( procedure (value: integer) var Recognition: string; begin ... Locking.EnterWriteLock; Try Recognition:= result_text.recognition_text >>>>> here is leak Finally Locking.ExitWriteLock; End; .... end); ... end; IRecognitionResult = interface(IDispatch) .... function Get_text: String; safecall; property recognition_text: String read Get_text; end; Can somebody explain how to avoid this? I have tried to change line to this: Recognition := Copy(result_text.recognition_text,1,Pos(#0,result_text.recognition_text)-1) because dll returns info like "Archive info#0aaa,bf;ddf...", but it does not help. Thanks.
-
Memory leak in UnicodeString to string conversion
dkprojektai replied to dkprojektai's topic in OmniThreadLibrary
sorry, I can't crop some lines and make example from 15000 lines of code with treading and third party libraries. -
Memory leak in UnicodeString to string conversion
dkprojektai replied to dkprojektai's topic in OmniThreadLibrary
I'm very sorry. I double check. The IRecognitionResult is: property recognition_text: WideString read Get_text; Should I somehow transform Recognition: string; into WideString? -
Memory leak in UnicodeString to string conversion
dkprojektai replied to dkprojektai's topic in OmniThreadLibrary
I can't change it - it's from third library -
Memory leak in UnicodeString to string conversion
dkprojektai replied to dkprojektai's topic in OmniThreadLibrary
Locking.EnterWriteLock; Try Recognition:= String(result_text.recognition_text); Finally Locking.ExitWriteLock; End; Remy - am I understand correctly? I should do like this? -
Hello, I have this code in thread: Try MotionBitmap1.Canvas.Lock; jpeg:= TJPEGImage.Create; jpeg.Assign(MotionBitmap1); jpeg.SaveToFile('D:\picture.jpg'); finally MotionBitmap1.Canvas.Unlock; Try FreeAndNil(jpeg); except end; end; I'd like to find out is it saved correctly and the image is in correct format and etc. Is there any solution to validate file?
-
11.jpg - corrupted. Can someone check? About Canvas.Lock - it should be done in Thread.
-
Software runs on many PC's without any problems. This issue I have only on 1 PC. It's Windows 7 32bit.
-
1. because it's in thread; 2. this saved picture later uses external dll library, and it sometimes make failure. That is why I thought - I need double check jpg. Unfortunately I did not found any solution on the net.
-
Hello I have memory leaks in thread. Need help to fix them: 1. NewBitmap:= TBitmap.Create; NewBitmap.Canvas.Lock; NewBitmap.PixelFormat:= pf24bit; NewBitmap_first.Canvas.Lock; Try NewBitmap.Width:= StrToInt(Detector_scan_right) - StrToInt(Detector_scan_left); NewBitmap.Height:= StrToInt(Detector_scan_bottom) - StrToInt(Detector_scan_top); NewBitmap.Canvas.CopyRect(NewBitmap.Canvas.ClipRect, NewBitmap_first.Canvas, Rect( <<<<< memory leak StrToInt(Detector_scan_left), StrToInt(Detector_scan_top), StrToInt(Detector_scan_right), StrToInt(Detector_scan_bottom) )); Finally NewBitmap.Canvas.Unlock; NewBitmap_first.Canvas.Unlock; End; 2. Tekst_string:= StringReplace(Tekst_string, 'data', '', [rfReplaceAll, rfIgnoreCase]); Thanks in advance. Delphi 10.2
-
I'll try to do Lock and UnLock everywhere where I will use bitmap before freeing it. straight Win32 API calls - can I get any example? I would like escape using Pascal library like graphics32 because then I will have to do many conversations. And this will impact to speed.
-
I use Deleaker: Program.exe!@System@@GetMem$qqri Line 4738 004075b0 Program.exe!@System@@NewUnicodeString$qqri Line 24650 0040c632 Program.exe!@Vcl@Graphics@TFont@GetHandle Line 2600 + 0xaadfa bytes 0058a6ca Program.exe!@Vcl@Graphics@TCanvas@CreateFont Line 4230 + 0xacbea bytes 0058c4ba Program.exe!@Unit1@TWorkerThread@Execute Line 10849 + 0xec3928 bytes 013a31f8 Program.exe!@Madexcept@HookedTThreadExecute$qqrpvt1 + 0x9c9ff bytes 004b0dab Program.exe!@System@Classes@ThreadProc$qqrxp22System@Classes@TThread Line 14945 + 0x60395 bytes 0053fc65 Program.exe!@System@ThreadWrapper$qqspv Line 24423 0040c580 Program.exe!@Madexcept@CallThreadProcSafe$qqspvt1 + 0x9c8e5 bytes 004b0c91 Program.exe!@Madexcept@ThreadExceptFrame$qqsp21Madexcept@TThreadInfo + 0x9c94a bytes 004b0cf6 KERNEL32.DLL!BaseThreadInitThunk + 0x17 bytes 776e0417 ntdll.dll!RtlGetAppContainerNamedObjectPath + 0xeb bytes 7781662b ntdll.dll!RtlGetAppContainerNamedObjectPath + 0xb8 bytes 778165f8 00000000 00000000
-
I do it later.
-
Very strange issue, Thread exits without any notice
dkprojektai posted a topic in Delphi IDE and APIs
Hello, I made some software in which on thread exception program exits(terminates) without any notice. What I do.. Make thread... FThread := TWorkerThread.Create(true); FThread.FreeOnTerminate := true; FThread.Start; After, I work with dll in it... try Try raise Exception.Create('Test Exception'); ----<<<< if here, no problem candidates:= Processor_analyze(proc,p,3*W, W, H,StrToInt(max_height)); ----<<<< call from dll raise Exception.Create('Test Exception'); ----<<<< if here, no problem except // end; raise Exception.Create('Test Exception'); ----<<<< if here - program terminates except // end; Can somebody help to solve? What to check? where to dig? Thanks. I have Delphi 10.2 -
Hi, made tests and finally find out how works error handling in Omnithread parallel.for. Here is my testing: procedure TbtnParallelFor.btnParallelForExceptionClick(Sender: TObject); var i: Integer; Loking_elem: TOmniMREW; Error_stack_text: string; begin Error_stack_text:= ''; Parallel.For(0, 10,1).Execute( procedure (i: integer) begin Try //What will happen if here will be error from dll??? if i = 4 then try finally integer(nil^):= 0; end; if i = 5 then integer(nil^):= 0; raise Exception.Create('Exception in thread ' + TThread.Current.ThreadID.ToString); except on E: Exception do begin Try if i = 5 then integer(nil^):= 0; Loking_elem.EnterWriteLock; Error_stack_text:= Error_stack_text + #13#10 + '---' + E.StackTrace; Loking_elem.ExitWriteLock; except on E: Exception do begin Loking_elem.EnterWriteLock; Error_stack_text:= Error_stack_text + #13#10 + '---' + E.StackTrace; Loking_elem.ExitWriteLock; end; end; end; end; end); Memo1.Lines.Text:= Error_stack_text; end; In my application (not in this example) I still getting application terminate on error and I can't cache it. I work with many dll's in commented section. I want to ask, what will happen if in there will be an error from dll? Is there any solution to cache it? Fault Offset: Faulting application name: Application.exe, version: 4.6.0.0, time stamp: 0x5d7fec1f Faulting module name: KERNELBASE.dll, version: 6.2.9200.16384, time stamp: 0x5010ac2f Exception code: 0xe06d7363 Fault offset: 0x00014b32 Faulting process id: 0x31c0 Faulting application start time: 0x01d56d40dd25c4a4 Faulting application path: C:\Application.exe Faulting module path: C:\Windows\SYSTEM32\KERNELBASE.dll Report Id: 3ff93c8d-d950-11e9-93fa-0a94ef1b475e Faulting package full name: Faulting package-relative application ID: Leads me to: Found: Provider: TELDebugInfoMap Location: (00C63D20){ANPR_VID.exe } [06483D20] OtlParallel.TOmniParallelSimpleLoop.Execute[2]$ActRec.$0$Body (Line 3440, "OtlParallel.pas" + 16) + $0 Unit: OtlParallel Source: OtlParallel.pas Class: TOmniParallelSimpleLoop.Execute[2]$ActRec Routine: $0$Body Line: 3440 Routine offset (bytes): 96 Routine offset (lines): 16 Line offset (bytes): 0 That is why I think that error rises dll and parallel.for is not able to handle it. Any comments are welcome.
-
Hi, because of exceptions I wanted to ask what should I use in task - sleep(3000) or Event.WaitFor(3000)? And is the Application.ProcessMessages needed when I want to get variables? Thanks.
-
I moved function MyFind out of Parallel.for(), now will take a look what's next 🙂
-
This is an exception in Parallel.for 0052a796 VID_full.exe System.Classes TStrings.LoadFromStream 0052a71f VID_full.exe System.Classes TStrings.LoadFromStream 0052a68f VID_full.exe System.Classes TStrings.LoadFromFile 012eb693 VID_full.exe Unit1 12308 MyFind 012eb8a9 VID_full.exe Unit1 12397 TWorkerThread.Execute$ActRec.$3$Body 011af3f6 VID_full.exe OtlParallel 3440 TOmniParallelSimpleLoop.Execute[2]$ActRec.$0$Body 011aefe2 VID_full.exe OtlParallel 3380 TOmniParallelSimpleLoop.CreateForTask$ActRec.$0$Body 0118a1bb VID_full.exe OtlTaskControl 1991 TOmniTaskExecutor.Asy_Execute 01189219 VID_full.exe OtlTaskControl 1584 TOmniTask.InternalExecute 01188ff2 VID_full.exe OtlTaskControl 1502 TOmniTask.Execute 0117bda2 VID_full.exe OtlThreadPool 889 TOTPWorkerThread.ExecuteWorkItem 0117b92b VID_full.exe OtlThreadPool 846 TOTPWorkerThread.Execute 0040c580 VID_full.exe System 25 ThreadWrapper 004ae119 VID_full.exe madExcept CallThreadProcSafe 004ae17e VID_full.exe madExcept ThreadExceptFrame 752f8541 KERNEL32.DLL BaseThreadInitThunk it rises on this function: // FindInFile: Returns the position where the string to search was found Function MyFind(Key: String): String; var List, LineList: TStringList; I, x: Integer; begin result := ''; List := TStringList.Create; List.LoadFromFile('List_file.txt'); <<<<< HERE try for I := 0 to List.Count - 1 do begin if pos (Key, List.Strings[I]) > 0 then begin result:= List.Strings[I]; break; end; end; finally List.Free; end; end; What I'm doing wrong? Should I pun it into TOmniMREW lock?
-
For the moment I've change Parallel.For to TParallel.For (Delphi paralell). Will wait and look is it helps...
-
ok, how to fix it? Or escape it? Prevent?
-
understood, but where to find the exception point? I understand that it is somewhere in Parallel.For. Or I'm wrong?