<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Hairy Pixels via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> schrieb am Sa., 19. Okt. 2024, 14:49:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Oct 19, 2024 at 7:37:15 PM, Martin Frb via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank" rel="noreferrer">fpc-pascal@lists.freepascal.org</a>> wrote:<br></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" type="cite">
Because if the latter, well I know some people who would shot the person<br>introducing that in a high performance software...<br></blockquote><div class="gmail_quote"><br></div><div class="gmail_quote" dir="ltr">yes it’s bad except for UI apps which is what FPC and new users seem to be focusing on. FPC has it already on some types which are widely used.</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">For UI apps it can also be bad depending on the performance impact. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" type="cite"><br>Actually, if we are talking safety (rather than comfort for the<br>developer) then we may not need ARC at all. Because freeing memory is<br>not the only (nor biggest?) worry. Running out of mem (and handling it<br>gracefully, and without vulnerability) is important too. But ARC<br>doesn't solve that.<br>One way to solve that is pre-allocate any mem that may be needed, and<br>then never free or alloc any mem thereafter. And then you need no ARC at<br>all.<br>
</blockquote><br>
</div><div class="gmail_quote" dir="ltr">FPC sadly has no concept of custom allocators for classes, just something you can add to the type itself but that’s very limited. I really like how Jai and Odin have added allocators in as a core part of the language and library. Zig does something like this too but it’s much more clumsy and tedious.</div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">For a class one can override NewInstance and FreeInstance. And with TVirtualMethodInterceptor (I think not yet implemented in FPC) it might even be possible to replace these on an existing class type without inheriting from it. I have not tested that yet, but it *might* work. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>