Re: The evil Perl reads freed things
[email protected] (Tim Bunce) Tue, 22 Jun 2004 17:29:25 +0100
| Newsgroups | perl.ponie.dev |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Jun 22, 2004 at 02:09:01PM +0100, Nicholas Clark wrote: > On Fri, Jun 18, 2004 at 08:36:59PM +0100, Nicholas Clark wrote: > > > Other tests fail in strange ways, and valgrind reports errors which are > > reads in the heads of now-free scalars. > > > > So, I'm not sure what to do, as this assumption that you can read any > > head even after it's undead seems to be quite deeply ingrained. And it > > needs to be solved before we can usefully replace heads with PMCs. [I wrote the next two paragraphs on Friday but didn't send it] Perl5 doesn't refcount what it puts on the stack. Assuming that's the cause of many/most of these cases, perhaps ponie will need to. But then again, won't that problem go away if/when ponie starts using GC instead of ref counting? > It seems that I can work round this problem by deferring free()ing the SV > heads until the next time temporaries are freed. So they're now put into > a linked list, and freed by free_tmps(). Seems reasonable. (I wonder if that timing is reliable or if there are cases where they'd need to be held for longer. Can't think of any. Though free_tmps may trigger DESTROYs so freeing the list at the end of free_tmps would be wise, but you're probably doing that anyway.) > Ponie in CVS now has SV* being a pointer to a PMC. (and all tests pass) Yeah. Good work. How's the performance situation? Tim.