일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- C# Devexpress
- 밀고
- Row Indicator
- devexpress grid
- C# Devexpress CheckListBoxControl 줄 바꿈
- C# linq pivot
- ColumnHead MultiLine
- 해운대밀면
- C# 빌드이벤트
- 밀면
- C# 0x8001010d
- visualstudio 관리자권한
- RichEditControl Bold
- C# 컬럼비교
- CustomDrawColumnHeader
- C# WndProc
- Delphi
- C# Devexpress CheckListBoxControl word wrap
- RichEditControl
- delphi JSON
- C# DataTable linq
- C#
- 델파이
- mssql 문자열 합치기
- C# 매크로
- DataTable ReadOnly
- C# column
- C# build
- C# SendMessage
- drawgrid
- Today
- Total
개발자의 사투
델파이 객체 자동 Free 본문
shared_ptr 개요(한글) : http://egloos.zum.com/sweeper/v/2826435
델파이 shared_ptr(git)
https://github.com/arafangion/delphisharedpointer
델파이 smartPointer
https://en.delphipraxis.net/topic/402-smart-pointers-generics-vrs-non-generic-implementastion/
https://github.com/marcocantu/DelphiSessions/blob/master/DelphiLanguageCodeRage2018/02_SmartPointers/SmartPointerClass.pas
=========================== 추가 참고 ===========================
간단한 Guard (객체 자동 Free)
http://www.delmadang.com/community/bbs_view.asp?bbsNo=3&bbsCat=0&st=S&keyword=guard&indx=196963&keyword1=guard&keyword2=&page=1
델파이판 AutoPtr
http://www.borlandforum.com/impboard/impboard.dll?action=read&db=component&no=557
해당글들을 참고하였고
https://github.com/arafangion/delphisharedpointer 최종 해당글을 사용하였습니다.
var
FSmartPointTest: TShared;
begin
FSmartPointTest.Create(TStringList.Create);
FSmartPointTest.Temporary.Add('aaaaa');
FSmartPointTest.Temporary.Add('bbbb');
ShowMessage(FSmartPointTest.Temporary.Text);
end;
간단한 테스트를 마침.
Free사용을 안해도 메모리릭오류 발생 x
단점은...
Some limitations that I could not resolve with Delphi:
- There is no way to mark the shared pointer as invalid - the developer, once the smart pointer has been released, must take care not to use the reference again, otherwise a runtime error will result. (Internally, the reference is nil'ed, but it is not a compiler error to attempt to use it).
- There is no way to overload the 'dot operator', similar to how smart pointers are done in C++. This does have the impact of making effective use of the shared pointer considerably more tedious.
- Destruction order is undefined. Hopefully this is not a problem, however, if it is a problem, then it will be recommended to .Release.Free the pointer manually, as appropriate, in a try/finally block.
보는바와같다....
'컴방 > 델파이' 카테고리의 다른 글
델파이 Grid Scroll 자연스럽게 하기 (0) | 2020.01.30 |
---|---|
델파이 BorderStyle속성 string으로 변경하기 (0) | 2020.01.23 |
델파이 폼 리사이즈 delphi Form Resize (0) | 2020.01.21 |
델파이 JSON 파일 읽기(delphi Json File Read) (0) | 2020.01.16 |
델파이 클릭, 더블클릭 구분 (0) | 2020.01.15 |