<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0">
  <title type="html">김 용묵의 절대공간 - 블로그: new와-delete-연산자-이야기에 달린 최근 댓글/트랙백 목록</title>
  <id>http://moogi.new21.org/tc/</id>
  <link rel="alternate" type="text/html" hreflang="ko" href="http://moogi.new21.org/tc/" />
  <subtitle type="html">그런즉 이제 애호박, 단호박, 늙은호박 이 셋은 항상 있으나, 그 중에 제일은 늙은호박이니라.</subtitle>
  <updated>2024-02-25T15:22:15+09:00</updated>
  <generator>Textcube 1.7.8 : Con moto</generator>
  <entry>
    <title type="html">삼각형님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/332#comment676" />
    <author>
      <name>(삼각형)</name>
    </author>
    <id>http://moogi.new21.org/tc/332#comment676</id>
    <published>2010-07-28T14:17:53+09:00</published>
    <summary type="html">new와 malloc에 관계에 대해 생각해 본 일이 없었는데 그런거군요. C와 C++은 다른 언어라고 생각하고 보는지라.

new/delete, malloc/free를 섞어 사용해도 작동하는군요.

마지막 문단에
new로 할당한 메모리를 delete로 해제...
에서 delete가 아니라, free아닌가요?</summary>
  </entry>
  <entry>
    <title type="html">사무엘님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/332#comment677" />
    <author>
      <name>(사무엘)</name>
    </author>
    <id>http://moogi.new21.org/tc/332#comment677</id>
    <published>2010-07-28T21:27:47+09:00</published>
    <summary type="html">예. 어차피 메모리 할당하고 해제하는 건 똑같고, C++ 라이브러리는 C 라이브러리에 의존성이 있는 형태이니까요.
그리고 free가 맞습니다. 저의 실수군요. ^^ 고쳤습니다.</summary>
  </entry>
  <entry>
    <title type="html">김재주님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/332#comment678" />
    <author>
      <name>(김재주)</name>
    </author>
    <id>http://moogi.new21.org/tc/332#comment678</id>
    <published>2010-07-29T01:06:54+09:00</published>
    <summary type="html">섞어 쓰면 문제가 될 가능성이 꽤 크죠. 일단 생성자와 소멸자라는 C++ 객체 시스템의 근간을 뒤흔드는 짓이니까요. 어리석은 행동이 될 가능성이 매우 높습니다.</summary>
  </entry>
  <entry>
    <title type="html">사무엘님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/332#comment679" />
    <author>
      <name>(사무엘)</name>
    </author>
    <id>http://moogi.new21.org/tc/332#comment679</id>
    <published>2010-07-29T15:18:18+09:00</published>
    <summary type="html">생성자/소멸자나 가상 함수가 있는 개체를 malloc/free질 하는 건 당연히 있을 수 없는 일이고요.
순수하게 메모리 할당/해제만 하면 되는 기본 자료형이나 구조체만으로 한정해도 C 방식과 C++ 방식의 혼용은 비추라는 것입니다. ^^</summary>
  </entry>
  <entry>
    <title type="html">김기윤님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/332#comment680" />
    <author>
      <name>(김기윤)</name>
    </author>
    <id>http://moogi.new21.org/tc/332#comment680</id>
    <published>2011-01-20T14:16:01+09:00</published>
    <summary type="html">디버깅할때 new 문장 에서 step into 하면 들어가는 void *__CRTDECL operator new(size_t size) _THROW1(_STD bad_alloc) 이 그거군요!

평소에는 제대로 쳐다보지도 않았는데, 자세히 보니 malloc 사용된게 보이네요!

그런데, delete 에서는 free가 사용되었다는 예측은 가지만, step into 해도 따로 함수로 들어가지는 않네요.</summary>
  </entry>
  <entry>
    <title type="html">사무엘님의 댓글</title>
    <link rel="alternate" type="text/html" href="http://moogi.new21.org/tc/332#comment681" />
    <author>
      <name>(사무엘)</name>
    </author>
    <id>http://moogi.new21.org/tc/332#comment681</id>
    <published>2011-01-20T17:47:54+09:00</published>
    <summary type="html">아무래도 delete 연산자에 대해 step in을 하면, 해당 개체의 소멸자 함수로 들어가지, operator delete 안으로 들어가는 건 딱히 못 본 것 같습니다. 그래도 heap 쪽에서 에러가 나면, 디버거가 operator delete 안에서 멈춰섰다고 안내는 잘 해 줍니다. ^^</summary>
  </entry>
</feed>
