<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>oop on yonmy</title><link>https://yonmy.com/tags/oop/</link><description>Recent content in oop on yonmy</description><generator>Hugo</generator><language>ko-KR</language><lastBuildDate>Wed, 17 Jan 2018 17:28:12 +0900</lastBuildDate><atom:link href="https://yonmy.com/tags/oop/index.xml" rel="self" type="application/rss+xml"/><item><title>c++에서 malloc과 new의 차이점</title><link>https://yonmy.com/archives/70/</link><pubDate>Wed, 17 Jan 2018 17:28:12 +0900</pubDate><guid>https://yonmy.com/archives/70/</guid><description>&lt;p&gt;제일 중요한 포인트는 생성자의 호출 유무이다.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;malloc&#10;&lt;ul&gt;&#10;&lt;li&gt;동적 메모리를 할당한다.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;new&#10;&lt;ul&gt;&#10;&lt;li&gt;동적 메모리를 할당한다.&lt;/li&gt;&#10;&lt;li&gt;생성자를 호출한다.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;마찬가지로, free와 delete의 핵심 차이점은 소멸자의 호출 여부&lt;/p&gt;&#10;&lt;p&gt;기타 차이점으로는&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;호출 하는 방법이 다르다.&lt;/li&gt;&#10;&lt;li&gt;new 의 경우에 메모리 할당에 실패하면 예외(std::bad_alloc)가 발생한다.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;hr&gt;&#10;&lt;p&gt;참고&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://msdn.microsoft.com/library/kftdy56f.aspx"&gt;https://msdn.microsoft.com/library/kftdy56f.aspx&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="http://en.cppreference.com/w/cpp/memory/new/operator_new"&gt;http://en.cppreference.com/w/cpp/memory/new/operator_new&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>