<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://socialledge.com/sjsu/index.php?action=history&amp;feed=atom&amp;title=Dynamic_Memory_Interview_Questions</id>
		<title>Dynamic Memory Interview Questions - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://socialledge.com/sjsu/index.php?action=history&amp;feed=atom&amp;title=Dynamic_Memory_Interview_Questions"/>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Dynamic_Memory_Interview_Questions&amp;action=history"/>
		<updated>2026-04-07T16:15:04Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.27.1</generator>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Dynamic_Memory_Interview_Questions&amp;diff=31711&amp;oldid=prev</id>
		<title>Proj user18: Proj user18 moved page Frequently Asked Interview Questions to Dynamic Memory Interview Questions</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Dynamic_Memory_Interview_Questions&amp;diff=31711&amp;oldid=prev"/>
				<updated>2016-12-18T10:17:49Z</updated>
		
		<summary type="html">&lt;p&gt;Proj user18 moved page &lt;a href=&quot;/sjsu/index.php/Frequently_Asked_Interview_Questions&quot; class=&quot;mw-redirect&quot; title=&quot;Frequently Asked Interview Questions&quot;&gt;Frequently Asked Interview Questions&lt;/a&gt; to &lt;a href=&quot;/sjsu/index.php/Dynamic_Memory_Interview_Questions&quot; title=&quot;Dynamic Memory Interview Questions&quot;&gt;Dynamic Memory Interview Questions&lt;/a&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 10:17, 18 December 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;' lang='en'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Proj user18</name></author>	</entry>

	<entry>
		<id>http://socialledge.com/sjsu/index.php?title=Dynamic_Memory_Interview_Questions&amp;diff=31634&amp;oldid=prev</id>
		<title>Proj user18: Created page with &quot;=== How does free() deallocate memory when no data related to size is passed as a parameter? ===  The memory allocation functions are implemented in such a way that certain me...&quot;</title>
		<link rel="alternate" type="text/html" href="http://socialledge.com/sjsu/index.php?title=Dynamic_Memory_Interview_Questions&amp;diff=31634&amp;oldid=prev"/>
				<updated>2016-12-18T06:05:55Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;=== How does free() deallocate memory when no data related to size is passed as a parameter? ===  The memory allocation functions are implemented in such a way that certain me...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== How does free() deallocate memory when no data related to size is passed as a parameter? ===&lt;br /&gt;
&lt;br /&gt;
The memory allocation functions are implemented in such a way that certain metadata for each allocated block is stored in-line or separately.&lt;br /&gt;
&lt;br /&gt;
Considering in-line metadata, the header information contains the size which is checked by free to understand how much of memory needs to be deallocated.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== What happens when free() is called on an already freed pointer? ===&lt;br /&gt;
&lt;br /&gt;
The behaviour is undefined. It could result in a crash, memory corruption or a segmentation fault.&amp;lt;br&amp;gt;&lt;br /&gt;
A good practise is to make the pointer a NULL after freeing.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
free(pointer_to_be_freed);&lt;br /&gt;
pointer_to_be_freed = nullptr;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== How can primitive data types be allocated using new? ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
int* i = new int(6);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What are the differences between new and malloc? ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| malloc&lt;br /&gt;
! scope=&amp;quot;col&amp;quot;| new &lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 1&lt;br /&gt;
| malloc is a function call&lt;br /&gt;
| new is an operator and can be overloaded&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 2&lt;br /&gt;
| malloc is concerned with basic memory allocation&lt;br /&gt;
| new invokes the constructor&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 3&lt;br /&gt;
| malloc returns a pointer to the memory block allocated which is of type void&lt;br /&gt;
| new returns a pointer of the exact datatype requested&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;row&amp;quot;| 4&lt;br /&gt;
| malloc never throws exceptions. On failure, it returns a NULL pointer&lt;br /&gt;
| On failure, new throws std::bad_alloc exception&lt;br /&gt;
|-&lt;/div&gt;</summary>
		<author><name>Proj user18</name></author>	</entry>

	</feed>