This is the mail archive of the
mailing list for the Archer project.
Re: Crash free()ing unallocated memory.
>>>>> "Tom" == Tom Tromey <firstname.lastname@example.org> writes:
Tom> I think we should add a new flag to pyty_type_object, and set the
Tom> flag in clean_up_objfile_types.
It occurred to me today that we will still see crashes.
Suppose you have a Type 't' with 'owned' == 1.
Then, you call pointer() on this Type, yielding 'p'
Then, arrange for 't' to be deleted.
Now the type field of 'p' will point to freed memory.
Actually, this code all seems pretty broken right now.
We don't seem to copy variant types, reference types, or pointer types.
delete_type_recursive doesn't look at these either.
Ideally we would memoize so that requests like pointer() on a Type
always yield the same Type. If we did this, though, we'd have to have
some cycle-breaking code to let reference counting work properly.
So, oops on me. I'll dig into this next week, too.