what segment of memory does the matlab primary work space and function work space occupies?

what segment of memory(data segment, stack segment) does the matlab primary work space and function work space occupies?

 Réponse acceptée

Not sure we understand your question completely, or why you are asking it. The memory for variable data typically comes from the heap, allowing for very large variables depending on your system memory and how fragmented it is. Is that what you are asking?

5 commentaires

Matlab's primary work space is different from m function files work space, is it right? If yes, say the two work space share a variable with same name, will it not create conflict upon calling if both are stored in same segment of memory? Like in C programming language local variables occupy stack segment and global variables occupy data segment.
Yes. Each function workspace is separate from other function workspaces and local names will not clash with each other. Local variable names inside functions, although they are created from the heap, do not clash with same-named variables in another function's workspace which are also created from the heap. They also don't clash with global variable names if that name is not declared as global inside the function. MATLAB does all of this name bookkeeping for you as part of memory management.
And where that heap lies? which segment of memory? And could you please explain how matlab does that bookkeeping, may be refer me to a link that discusses this thing? Thanks for your response.
The heap is basically your main computer memory that all of your programs have access to through the operating system. For the variable name and workspace bookkeeping, that is proprietary to MATLAB and I am not aware of any official documentation discussing the details beyond the basics of what I have already written.
Thanks it was really helpful.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Coder dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by