80x24.org misc. Free Software, open data formats/protocols discussion
 help / color / Atom feed
From: Eric Wong <e@80x24.org>
To: misc@80x24.org
Subject: Perl5 vs *nix filesystem refcounting
Date: Fri, 13 Jan 2017 08:02:09 +0000
Message-ID: <20170113080209.GA5402@whir> (raw)

Cyclic references is one of the few major problems for
reference counting implementations in managing resource
reclamation.

In Perl 5, cyclic references must be prevented or broken
by the programmer if they wish to prevent running out of
memory.  To the contrary, it's never been a problem for
*nix filesystems because of one important design decision:

	Directories may not have hard links.

In other words:

	Container types may only have a single reference.

On the filesystem there is one container type: directories.
References on an FS are filenames, and because the link(2)
syscall to create hard links does not work on directories,
the st_nlink reference counter may never be >= 1 on a directory.

In Perl5, the container types: hashes, lists (arrays), and
anonymous subroutines may all have multiple references which
point to the same underlying object.  Merely allowing multiple
references to the same object allows the possibility of a cycle.
Oh well...


But still (at least nowadays), I'd rather deal with this caveat
in Perl5 than the complexity and/or unpredictability of GC.

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170113080209.GA5402@whir \
    --to=e@80x24.org \
    --cc=misc@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

80x24.org misc. Free Software, open data formats/protocols discussion

Archives are clonable:
	git clone --mirror https://80x24.org/misc
	git clone --mirror http://ou63pmih66umazou.onion/misc

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.org.80x24.misc
	nntp://ou63pmih66umazou.onion/inbox.org.80x24.misc

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox