Skip to main content

Command Palette

Search for a command to run...

JS Memory allocation

Published
โ€ข1 min readโ€ขView as Markdown

1) Javascript has 5 primitive types data types. Boolean, null, undefined, String, and Number. [ That are passed by value]

2) Javascript has 3 data types that are passed by reference: Array, Function, and Object. These are all technically Objects, so weโ€™ll refer to them collectively as Objects.

JavaScript engines have two places where they can store data: The memory heap and stack.

Source

Heaps and stacks are two data structures that the engine uses for different purposes.

Stack

Primitive values and references ,Size is known at compile time,Allocates a fixed amount of memory

Heap

Objects and functions Size is Known at run Time . No limit per object .

More from this blog

JSDev

21 posts