Download Game! Currently 73 players and visitors. Last logged in:CelbornKandaharIberiamsspGunk

Blitzer's Blog >> 71848

Back to blogs index
Posted: 29 Aug 2026 22:39 [ permalink ]
user@elli:~/GD$ pwd
user@elli:~/GD$ ls -ltra
total 32
-rw-r--r--  1 user user 1710 Aug 29 21:39 mvp.js
-rw-r--r--  1 user user 4520 Aug 29 21:40 LPCVirtualMachine.js
drwxr-sr-x 18 user user 4096 Aug 29 22:16 ..
-rw-r--r--  1 user user 5516 Aug 29 22:37 GlobalHandleLedger.js
drwxr-sr-x  2 user user 4096 Aug 29 22:38 .
-rw-r--r--  1 user user  615 Aug 29 22:38 day1.js
user@elli:~/GD$ node day1.js 
Allocated handle: 0
Node data: {
  refCount: 1,
  typeTag: 2,
  prevHandle: -1,
  nextHandle: -1,
  payloadSize: 16,
  dataOffset: 0
}
After free, active count: 0
Free count: 10
user@elli:~/GD$ 

Key points
Intrusive linked list  The prev and next handles are stored inside the node
itself, making traversal fast and cachefriendly.

Flat storage  All data lives in a single Int32Array, which is isomorphic
(works in Node, browsers, and can be memorymapped).

Explicit refcounting  refInc / refDec give finegrained control; when a ref
count hits zero, the node is returned to the free list.

Hotreload friendly  The ledger can be reset or extended by reinitialising the
array, and all handles are just indices.

This completes Milestone 1.2  the foundation for memory management in your
isomorphic VM. Next steps will use this ledger to implement string allocation
and other object types.