stack vs heap

Stack [ local variable]

-Variable like int, char, float are store in stack.(Complex structures also array,struct)

-What is – stack is special region in computer memory, its stores temporary variables created by each function, stack is FILO (first in last out)

-Every time a function declare a new variable it pushed into stack, when function exits pushed elements are freed(pop), once stack variables are freed , that region of memory available for other stack variable

-Memory managed (Allocation and free) by CPU efficiently, also read and write stack is very fast

-Keep in mind the stack memory region also limited by varies on OS,

Heap [Global Variable]

-Heap region memory not managed by CPU, it is free floating region of memory (larger), in ‘C language’ use malloc, calloc to allocate memory,realloc to reallocate the memory, once we allocated we need to free up if not used then only other process takes the memory when not in use, if we fail to  do this memory leak problem occur

When to use

-if u need large block of memory, and access variable globally by any function then use Heap

 

 

Ref: http://gribblelab.org/CBootcamp/7_Memory_Stack_vs_Heap.html

Advertisements
Posted in data structure, Uncategorized | Tagged , , | Leave a comment

Careers for those who love Mathematics

A great article about career guide for those who love mathematics, explains importance of mathematics, employment outlook, mathematics education…

http://www.employmentnews.gov.in/Careers-for-those-Mathematics.asp

Posted in math, Uncategorized | Tagged , , | Leave a comment

Let’s salute the Nation on Republic Day

Few facts about our Motherland India ,,,,,,,,,

Saffron – Strength and Courage.
The white middle band –  for Peace and Truth.
The Green – for Fertility, Growth and Auspiciousness.
The Sanskrit name for India is – Bharat
India is derived from River Indus (Sindhu) where Aryans Settled.
Aryabhatta invented Zero
Oldest University in the world was Takshila( 700 BC) – 10,500 students from all over world learnt 60 subjects
Nalanda University still exists (4th Century)
Ayurveda is the earliest known school of medicine. Its father Charaka, consolidated Ayurveda 2500 years ago.
Art of Navigation and Navigating was first born in river Sindhu. The word Navigation is derived from Sanskrit word Navagatih.
In 5th Century Bhaskracharya rightly calculated the time taken by the earth to complete orbit – 365.258756484
My India , My Pride – Vande Mataram
Let’s salute the Nation on Republic Day

Src : https://plus.google.com/u/0/103435799818457589333

Posted in india, Uncategorized | Tagged , , , , | Leave a comment

LivecricScoreNews

Display Live cricket score and top cricket news

Features

  • Your office or workstation blocked cricket sites, this app works for you
  • Easy UI & Fast score and news update

Download Desktop app https://goo.gl/OjMbBX

Review & Feedback https://goo.gl/5SSPMU

Website  http://laxman954.github.io/livecricketscore/

 

my_cric_app

If you face any issues check wiki – https://github.com/laxman954/livecricketscore/wiki

Score & news source by cricinfo.com

 

 

Posted in Projects, Uncategorized | Tagged , , , | Leave a comment

Direct link to add specific google calendar event?

Direct link to add specific google calendar event

https://calendar.google.com/calendar/render?action=TEMPLATE&pli=1&sf=true&output=xml& text=[Event_Title]& details=[Event_Details]&location=[Event_Location]& dates=[From_Date_Time]/[To_Date_time]

for e.g

https://calendar.google.com/calendar/render?action=TEMPLATE&pli=1&sf=true&output=xml&text=Sample Event&details=Sample Events Details &location=Location&dates=20151208T180000Z/20151208T191500Z

Dates are given YYYYMMDDTHHMMSSZ format, use GMT time, google automatically convert into your calendar default one

 

google-add-events-link

Posted in Uncategorized, web | Tagged , , | Leave a comment

Number. 89

the number 89’s “reverse add” sequence until it reaches palindrome glory.

image

Posted in Uncategorized | Leave a comment

Watch “Fold and Cut Theorem – Numberphile” on YouTube

Fold and Cut Theorem – Numberphile: http://youtu.be/ZREp1mAPKTM

All alphabets created single cut by scissors

Posted in Uncategorized | Leave a comment

Spring inject value into a static field

using org.springframework.beans.factory.config.MethodInvokingFactoryBean to invoke a static setter.

e.g
public Class ClassName{
private static Object fieldName;
public static void setFieldName(final Object fieldName)
{
ClassName.fieldName = fieldName;
}
}

Spring Injection:

<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod" value="package.ClassName.setFieldName" />
<property name="arguments">
<list>
<ref bean="refObject" />
</list>
</property>
</bean>

Ref:

Posted in JAVA, spring | Tagged , | Leave a comment

Take a look at “PNR Status”

A very good from railtrip, handful app for train traveller …
Many features include sms synch for ur train trip, history of train info, top news, live train status, pnr status, speedometer..
image

image

image

https://play.google.com/store/apps/details?id=com.railyatri.in.mobile

Posted in Uncategorized | Leave a comment

delete multiple files and files in windows using command prompt in less time

Take too much to delete too many files folder in window explorer.

Using following simple steps to delete files using command prompt with less time

use rmdir to delete the files and subfolder,

rmdir /s/q MyFolderPath
However, it is significantly faster, especially when you have a lot of subfolders in your structure to use del before the rmdir, like this:

del /f/s/q MyFolderPath > nul
rmdir /s/q MyFolderPath

Posted in file, technology, windows | Tagged , | Leave a comment