Seenkao писал(а):zub, нет ))), не это меня интересует. А именно по освобождению памяти от стоковых переменных. Есть где и что написано? На любом языке и на любом ЯП. )))
https://blogs.embarcadero.com/understan ... nting-arc/
https://ejudge.lksh.ru/lang_docs/fpc/ref.pdf
CHAPTER 3. TYPES
S2:=S1;
results in the reference count of S2 being decreased with 1, The reference count of S1is increasedby 1, and finally S1(as a pointer) is copied to S2. This is a significant speed-up in the code.If the reference count of a string reaches zero, then the memory occupied by the string is deallocated automatically, and the pointer is set to Nil, so no memory leaks arise. When an ansistring is declared, the Free Pascal compiler initially allocates just memory for a pointer,not more. This pointer is guaranteed to be Nil, meaning that the string is initially empty. This is truefor local and global ansistrings or ansistrings that are part of a structure (arrays, records or objects).This does introduce an overhead. For instance, declarin
http://docwiki.embarcadero.com/Librarie ... AnsiString
Because AnsiString variables have pointers, two or more of them can reference the same value without consuming additional memory. The compiler exploits this to conserve resources and execute assignments faster. Whenever an AnsiString variable is destroyed or assigned a new value, the reference count of the old AnsiString (the variable's previous value) is decremented and the reference count of the new value (if there is one) is incremented; if the reference count of a string reaches zero, its memory is deallocated. This process is called reference counting. When indexing is used to change the value of a single character in a string, a copy of the string is made if--but only if-- its reference count is greater than one. This is called copy-on-write semantics.
http://docwiki.embarcadero.com/RADStudi ... es_(Delphi)
Dynamic arrays are always integer-indexed, always starting from 0.
Dynamic-array variables are implicitly pointers and are managed by the same reference-counting technique used for long strings. To deallocate a dynamic array, assign nil to a variable that references the array or pass the variable to Finalize; either of these methods disposes of the array, provided there are no other references to it. Dynamic arrays are automatically released when their reference-count drops to zero. Dynamic arrays of length 0 have the value nil. Do not apply the dereference operator (^) to a dynamic-array variable or pass it to the New or Dispose procedure.