80x24.org misc. Free Software, open data formats/protocols discussion
 help / Atom feed
* Perl5 vs *nix filesystem refcounting
@ 2017-01-13  8:02 Eric Wong
  0 siblings, 0 replies; 1+ messages in thread
From: Eric Wong @ 2017-01-13  8:02 UTC (permalink / raw)
  To: misc

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

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.

^ permalink raw reply	[flat|threaded] 1+ messages in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13  8:02 Perl5 vs *nix filesystem refcounting Eric Wong

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:

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

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