Managed pointers lazarus / 64-FPC development ---------------------------------------------------------------------- jksmithiii · 2024-12-13 18:49 Surely this has already been beaten on, but a pointer type with Initialize and Finalize operators. Of value or no? ---------------------------------------------------------------------- cdbc · 2024-12-13 19:25 Hi AFAICR 'AllocMem' initializes allocated memory to zeroes before returning it to you. ...And there's 'FreeMemAndNil', which deallocates mem sets the pointer to nil.Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  ManagedMem = array of byte; // dynamic arraybegin  setlength(ManagedMem,100); // uninitialized  ... use your lump of 100 bytes mem ...  // since dynamic arrays are managed types,   // this deallocates when going out of scopeend; Otherwise, @Thaddy did something clever with 'SmartPointer', you'll have to search the forum for that... Regards Benny ---------------------------------------------------------------------- jksmithiii · 2024-12-13 19:42 Pointer types with implicit initialize and finalize when pointer goes in/out of scope. That's the built-in safety value. Could write a lib around that using pointer records I suppose.