Re: The evil Perl reads freed things
[email protected] (Nicholas Clark) Tue, 22 Jun 2004 20:12:54 +0100
| Newsgroups | perl.ponie.dev |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Jun 22, 2004 at 05:29:25PM +0100, Tim Bunce wrote: > 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's the cause of the checks w.r.t. freeing an array you're iterating over in a for loop. But there seem to be other places. I'm hoping that all the stack related problems go away ones the stack is garbage collected. > 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.) Yes. I figured that free_tmps would only be adding to the list of things that needed freeing soon, so best to do it after that. :-) > > > Ponie in CVS now has SV* being a pointer to a PMC. (and all tests pass) > > Yeah. Good work. > > How's the performance situation? I've no idea. I expect it's slower than before, because now SvANY() and SvFLAGS() involve (at least) 2 function calls. Nicholas Clark