Better HN
topnewbestaskshowjobs
Log inSign up

esneider

197 karma · joined Dec 8, 2013 (12y ago) · 7 submissions

Submissions

comment 10y ago · link · parent

I wrote that algorithm! A year later I found Hacker's delight, a wonderful book that had a much "faster" version of the same algorithm (less ops).

For anyone interested in this kind of things, you should go read that book. It actually is a delight.

2.

Y U NO commit??(github.com ↗)

212 points · by esneider · 12y ago · 132 comments

comment 12y ago · link · parent

Fair enough... I thought it would be more difficult/inefficient to check for cyclic hierarchies, but it wasn't.

Fixed! Thanks.

comment 12y ago · link · parent

Yep, you can also do

  void *p;
  free(p);
  free(p);
Don't get me wrong, I get where you are going. But C philosophy is that libraries shouldn't do expensive checking to detect programmers' errors.

comment 12y ago · link · parent

Hierarchical memory allocations are a great concept. But Samba's talloc is kind of bloated, with all the reference counting, destructors and stuff.

Here is a simple, 200-line version of just the hierarchical allocator: https://github.com/esneider/talloc