- Memory is the land where data “buildings” (variables, arrays, structs) stand.
- Tables are the city directory listing services (function references) for quick access.

WebAssembly Memory
WebAssembly memory is a sandboxed, growable linear buffer of bytes. It holds everything from your module’s numeric data to string buffers.| Feature | Description |
|---|---|
| Continuous | Represented as one contiguous array of bytes |
| Resizable | Can be expanded at runtime (within limits) |
| Isolated | Sandboxed to prevent corruption of the host or other modules |

Out-of-bounds memory accesses in WebAssembly always trap, ensuring that modules cannot read or write arbitrary host memory.
.wat module like this:

WebAssembly Tables
Tables are lookup structures for function references (and, with the reference types proposal, external references). They don’t contain code—only pointers—enabling indirect calls and dynamic dispatch.
funcref entries:
call_indirect with 0 or 1, WebAssembly jumps to $f1 or $f2 respectively—just like dialing a number on a menu.

If you call an uninitialized or out-of-bounds table index, WebAssembly will trap immediately.
externref feature, tables can also hold references to host objects (e.g., JS DOM nodes or game entities). This powerful extension enables seamless interoperability between WebAssembly modules and their host environment.

Summary
WebAssembly’s memory and tables provide:- Secure, linear storage for all data
- Dynamic, sandboxed function dispatch
- Runtime growth and module evolution without rewriting callers