Jump to content
Sign in to follow this  
desperado

Where does memory gets created for the following process???

Recommended Posts

Hi All,

A small clarification, where does memory gets created for the following process.

Because memory are basically into stack , heap memory.

--> For object allocation the tool is going to use the heap memory.

--> For initialized variables and static variables the tool is going to use the stack memory.

--> For recursive functions and re-entrant task what type of memory is been used by the tool??

Kindly let me know the same and as well correct me if I am wrong.

Thanks,

Desperado --> "Basics always important for mighty works"

Share this post


Link to post
Share on other sites

hi,

the IEEE1800-2009 ch 6.21 "scope and lifetime" has some information about this topic. however the standard doesnt talk about heap/stack because this distinction is secondary. the storage elements have to follow a clear "lifetime" semantic.

depending upon their lifetime objects can be allocated on the stack or on the heap. for instance you could even allocate objects on the stack but you would need to move them to the heap if the reference to the object is used outside of the stackframe.

is there a particular reason for your question? why do you care? i mean as long as the semantic is preserved any implementation is correct.

regards

/uwe

Share this post


Link to post
Share on other sites

hi desperado,

>As an engineer, I am pretty curious on what's happen even behind the screen and so does was my question on this forum. Can you elaborate to my questions plz.

as i said this is implementation/tool specific and every tool does have an own (correct) implementation. also the terms "stack"/"heap" memory are not clear in the context - i mean there is a stack for the machine code you are executing and there is a (user) stack of your sv program - this might be somewhere else (for instance in the heap memory). but again this depends on your simulator and code architecture. so there is not concrete answer to your question.

btw: functions and tasks are normally code or data sections (as they do not change during runtime, creating another object doesnt double the code streams). so its neither on the stack nor in the memory pool. i dont think "recursive" or "re-entrant" does make a change here.

regards

/uwe

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...