2

how is memory accessed in javascript?

2
  • where is (say Math, whatever it is) stored?? Commented Dec 23, 2010 at 7:43
  • 1
    discover an exploit in the javascript engine but it's not very general solution though, may not fit your purpose:) Commented Dec 23, 2010 at 8:06

3 Answers 3

6

Short answer: It's not.

Longer answer: You cannot directly access memory from JavaScript. Of course any objects you create are stored in memory somewhere, and you can access them, but that's it.

Sign up to request clarification or add additional context in comments.

Comments

4

Since JavaScript is an interpreted language, there is no single and conclusive answer to this question, except for: Every time you assign or change a variable, and every time you create a function, your JavaScript engine will handle assigning memory for you. The same is true for freeing up memory, when the resources are no longer needed. Every browser comes with its own JavaScript engine, so the way this is done may vary greatly.

Comments

1

JavaScript allocates and frees memory automatically. Furthermore, there's no pointer arithmetic in JavaScript.

2 Comments

where is (say Math) whatever it is stored??
@Abkutty: the browser supplies it as some sort of "internal library" (please no technical discussion about this term). It's internal and you don't need to care about it. It's somewhat related to using some sort of a dynamic library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.