develooper Front page | perl.perl5.porters | Postings from March 2001

Re: :Photo using large amounts of memory

Thread Previous | Thread Next
Ilya Zakharevich
March 15, 2001 11:33
Re: :Photo using large amounts of memory
Message ID:
[I Cc it to p5p.]

On Thu, Mar 15, 2001 at 09:51:48AM -0900, Everett, Toby wrote:
> And it's that last parenthetical statement that confirms what I feared -
> that XSUBs aren't necessarily pure Perl.
> The approach of scanning all known space for references, though, still
> leaves the disconnected reference loop problem.  The only way to get rid of
> disconnected reference loops without programmer intervention is one based on
> starting with the namespace and lexically scoped variables

"Lexically scoped variables" are hanging from scratchpads of
subroutines.  So if the GC knows about the layout of different Perl
structures (including CV), then it gets lexical stuff automatically.

So you start from MAIN_SUB, %{main::} - and sv_yes sv_no sv_undef
which are 3 predefined values, and you should walk from there.

> and then working
> outwards from there to enumerate all known space, right?  I don't speak much
> XSUB (the closest I've gotten was writing some trivial XS routines to split
> stereo WAV data into two mono streams), so forgive my ignorance.  Are there
> "references" to the XSUBs that would ensure that the XSUB data gets caught
> by such a sweep?

Why do you want to free "data"?  All you need to free is SVs, right?
SVs are allocated in arenas, which are few in number and linked with each
other anyway.  Just create the dependence graph of arenas - which
should be easy since you know the layout of SVs.

And ask the XSUBs to mark the SVs stored in a static C's SV* by an
appropriate flag, so you know they are "used".  Similar for sv_yes
sv_no sv_undef.  Hmm, probably the latter is not needed, since IIRC
sv_yes sv_no sv_undef do not live in arenas...


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About