> Marco van de Voort wrote: > >>>a valid/invalid reference without accessing memory that is invalid in the > >>>mean > >>>time. > >> > >>How does a GC do this? It would have the same problem? > > > > > > A GC manages all memory, local variable allocation inclusive. IOW, the > > way a GC does it, is not possible in a mixed environment. > > Are you saying it would be a managed pointer then which is allocated on > the heap? (I had assumed the pointer would be on the stack and the > object in the heap)
That is a solution yes. Or on the stack, but on termination the reference is killed, and you are back at the try..finally again > > It's very expensive. getmem is quite expensive, and you need it for every > > reference this way. > > Okay then use Tlist with preallocation of say half a dozen references - > that should be efficient for 99% of cases for an individual object's > references. Still an dyn allocation extra. Ansistring performance is partially bound to it, and you double it. > > Nothing is failsafe. However e.g. in RTL string routines exceptions > > shouldn't occur unless memory is exhausted, in case it doesn't matter > > much anyway. > > What about all other non string exceptions that can occur between > creation and destruction of the ansistring? They lead to mem leaks. > Multithreaded environments too? Yes. _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel