{"id":214,"date":"2010-06-01T00:00:21","date_gmt":"2010-05-31T15:00:21","guid":{"rendered":"http:\/\/dev.activebasic.com\/egtra\/?p=214"},"modified":"2011-09-25T17:53:04","modified_gmt":"2011-09-25T08:53:04","slug":"c-with-gc","status":"publish","type":"post","link":"https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/","title":{"rendered":"C++ with GC"},"content":{"rendered":"<p>\u5272\u3068\u305f\u3044\u305d\u3046\u306a\u984c\u540d\u3092\u4ed8\u3051\u305f\u3064\u3082\u308a\u3067\u3059\u3002\u3067\u3082\u3001\u305d\u3093\u306a\u5927\u305d\u308c\u305f\u3053\u3068\u3092\u8a00\u3046\u3064\u3082\u308a\u306f\u306a\u3044\u3067\u3059\u3002<\/p>\n<p>\u5148\u9031\u571f\u66dc\u306e\u67d0\u554f\u3044\u8a70\u3081\u308b\u4f1a\u3067\u3082\u5c11\u3057\u8a71\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u73fe\u884c\u306eC++\u3067\u3053\u3046\u3044\u3046\u98a8\u306b\u30ac\u30d9\u30fc\u30b8\u30b3\u30ec\u30af\u30b7\u30e7\u30f3(GC)\u3092\u4f7f\u3046\u3053\u3068\u3092\u8a66\u3057\u3066\u307f\u305f\u3044\u3068\u524d\u3005\u304b\u3089\u8003\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre lang=\"cpp\" line=\"1\">void* operator new(std::size_t x)\r\n{\r\n    \/\/ \u9762\u5012\u306a\u306e\u3067set_new_handler\u975e\u5bfe\u5fdc\r\n    if (void* p = GC_malloc(x)) \/\/ Boehm GC\u306a\u3069\r\n    {\r\n        return p;\r\n    }\r\n    else\r\n    {\r\n        throw std::bad_alloc();\r\n    }\r\n}\r\n\r\nvoid operator delete(void* p)\r\n{\r\n} \/\/ \u4f55\u3082\u3057\u306a\u3044\r\n\r\n\/\/ operator new[]\u3068operator delete[]\u3082\u540c\u69d8\u306b\u5b9a\u7fa9\u3059\u308b<\/pre>\n<p>\u30e1\u30e2\u30ea\u7ba1\u7406\u3060\u3051GC\u3092\u7528\u3044\u3001\u30c7\u30b9\u30c8\u30e9\u30af\u30bf\u306a\u3069\u305d\u308c\u4ee5\u5916\u306e\u30bb\u30de\u30f3\u30c6\u30a3\u30af\u30b9\u306f\u4eca\u307e\u3067\u306e\u901a\u308a\u3067\u3059\u3002\u4eca\u307e\u3067\u306eC++\u30b3\u30fc\u30c9\u304c\u305d\u306e\u307e\u307e\u4f7f\u3048\u308b\uff08\u5c0e\u5165\u304c\u5bb9\u6613\uff09\u3068\u3044\u3046\u7279\u9577\u306e\u4e00\u65b9\u3001shared_ptr\u306a\u3069GC\u306b\u983c\u308b\u306a\u3089\u8981\u3089\u306a\u3044\u306f\u305a\u306e\u30b3\u30fc\u30c9\u304c\u305d\u306e\u307e\u307e\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u306b\u306a\u3063\u3066\u3057\u307e\u3046\uff08\u30e1\u30e2\u30ea\u4ee5\u5916\u306e\u30ea\u30bd\u30fc\u30b9\u7ba1\u7406\u304c\u3042\u308b\u5834\u5408\u3092\u9664\u304f\uff09\u3053\u3068\u304c\u5927\u304d\u306a\u6b20\u70b9\u306b\u306a\u308b\u3068\u8003\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3082\u3061\u308d\u3093\u4fdd\u5b88\u7684GC\u3057\u304b\u4f7f\u3048\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u3053\u306e\u6848\u306b\u304a\u3044\u3066\u306f\u3001\u4e16\u4ee3\u5225GC\u306a\u3069\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u79fb\u52d5\u3092\u4f34\u3046GC\u306e\u5229\u7528\u3092\u8003\u3048\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u306e\u3046\u3061\u3001\u9069\u5f53\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u8a66\u3057\u3066\u307f\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5272\u3068\u305f\u3044\u305d\u3046\u306a\u984c\u540d\u3092\u4ed8\u3051\u305f\u3064\u3082\u308a\u3067\u3059\u3002\u3067\u3082\u3001\u305d\u3093\u306a\u5927\u305d\u308c\u305f\u3053\u3068\u3092\u8a00\u3046\u3064\u3082\u308a\u306f\u306a\u3044\u3067\u3059\u3002 \u5148\u9031\u571f\u66dc\u306e\u67d0\u554f\u3044\u8a70\u3081\u308b\u4f1a\u3067\u3082\u5c11\u3057\u8a71\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u73fe\u884c\u306eC++\u3067\u3053\u3046\u3044\u3046\u98a8\u306b\u30ac\u30d9\u30fc\u30b8\u30b3\u30ec\u30af\u30b7\u30e7\u30f3(GC)\u3092\u4f7f\u3046\u3053\u3068\u3092\u8a66\u3057\u3066\u307f\u305f\u3044\u3068\u524d\u3005 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5,1],"tags":[51],"class_list":["post-214","post","type-post","status-publish","format-standard","hentry","category-cpp","category-misc","tag-new-operator"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C++ with GC - \u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d<\/title>\n<meta name=\"description\" content=\"\u5272\u3068\u305f\u3044\u305d\u3046\u306a\u984c\u540d\u3092\u4ed8\u3051\u305f\u3064\u3082\u308a\u3067\u3059\u3002\u3067\u3082\u3001\u305d\u3093\u306a\u5927\u305d\u308c\u305f\u3053\u3068\u3092\u8a00\u3046\u3064\u3082\u308a\u306f\u306a\u3044\u3067\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C++ with GC - \u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d\" \/>\n<meta property=\"og:description\" content=\"\u5272\u3068\u305f\u3044\u305d\u3046\u306a\u984c\u540d\u3092\u4ed8\u3051\u305f\u3064\u3082\u308a\u3067\u3059\u3002\u3067\u3082\u3001\u305d\u3093\u306a\u5927\u305d\u308c\u305f\u3053\u3068\u3092\u8a00\u3046\u3064\u3082\u308a\u306f\u306a\u3044\u3067\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/\" \/>\n<meta property=\"og:site_name\" content=\"\u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ysk.noh\" \/>\n<meta property=\"article:published_time\" content=\"2010-05-31T15:00:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2011-09-25T08:53:04+00:00\" \/>\n<meta name=\"author\" content=\"egtra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@egtra\" \/>\n<meta name=\"twitter:site\" content=\"@egtra\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"egtra\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/\",\"url\":\"https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/\",\"name\":\"C++ with GC - \u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d\",\"isPartOf\":{\"@id\":\"https:\/\/dev.activebasic.com\/egtra\/#website\"},\"datePublished\":\"2010-05-31T15:00:21+00:00\",\"dateModified\":\"2011-09-25T08:53:04+00:00\",\"author\":{\"@id\":\"https:\/\/dev.activebasic.com\/egtra\/#\/schema\/person\/8de756b2ff20b964f64594dfe8f18164\"},\"description\":\"\u5272\u3068\u305f\u3044\u305d\u3046\u306a\u984c\u540d\u3092\u4ed8\u3051\u305f\u3064\u3082\u308a\u3067\u3059\u3002\u3067\u3082\u3001\u305d\u3093\u306a\u5927\u305d\u308c\u305f\u3053\u3068\u3092\u8a00\u3046\u3064\u3082\u308a\u306f\u306a\u3044\u3067\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u30db\u30fc\u30e0\",\"item\":\"https:\/\/dev.activebasic.com\/egtra\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C++ with GC\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dev.activebasic.com\/egtra\/#website\",\"url\":\"https:\/\/dev.activebasic.com\/egtra\/\",\"name\":\"\u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d\",\"description\":\"\u982d\u306e\u4e2d\u306e\u304b\u3051\u3089\u3002ActiveBasic\u3092\u4e2d\u5fc3\u306b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u8a71\u3092\u307c\u3061\u307c\u3061\u3068\u3002\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dev.activebasic.com\/egtra\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/dev.activebasic.com\/egtra\/#\/schema\/person\/8de756b2ff20b964f64594dfe8f18164\",\"name\":\"egtra\",\"sameAs\":[\"https:\/\/x.com\/egtra\"],\"url\":\"https:\/\/dev.activebasic.com\/egtra\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C++ with GC - \u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d","description":"\u5272\u3068\u305f\u3044\u305d\u3046\u306a\u984c\u540d\u3092\u4ed8\u3051\u305f\u3064\u3082\u308a\u3067\u3059\u3002\u3067\u3082\u3001\u305d\u3093\u306a\u5927\u305d\u308c\u305f\u3053\u3068\u3092\u8a00\u3046\u3064\u3082\u308a\u306f\u306a\u3044\u3067\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/","og_locale":"ja_JP","og_type":"article","og_title":"C++ with GC - \u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d","og_description":"\u5272\u3068\u305f\u3044\u305d\u3046\u306a\u984c\u540d\u3092\u4ed8\u3051\u305f\u3064\u3082\u308a\u3067\u3059\u3002\u3067\u3082\u3001\u305d\u3093\u306a\u5927\u305d\u308c\u305f\u3053\u3068\u3092\u8a00\u3046\u3064\u3082\u308a\u306f\u306a\u3044\u3067\u3059\u3002","og_url":"https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/","og_site_name":"\u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d","article_publisher":"https:\/\/www.facebook.com\/ysk.noh","article_published_time":"2010-05-31T15:00:21+00:00","article_modified_time":"2011-09-25T08:53:04+00:00","author":"egtra","twitter_card":"summary_large_image","twitter_creator":"@egtra","twitter_site":"@egtra","twitter_misc":{"\u57f7\u7b46\u8005":"egtra"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/","url":"https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/","name":"C++ with GC - \u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d","isPartOf":{"@id":"https:\/\/dev.activebasic.com\/egtra\/#website"},"datePublished":"2010-05-31T15:00:21+00:00","dateModified":"2011-09-25T08:53:04+00:00","author":{"@id":"https:\/\/dev.activebasic.com\/egtra\/#\/schema\/person\/8de756b2ff20b964f64594dfe8f18164"},"description":"\u5272\u3068\u305f\u3044\u305d\u3046\u306a\u984c\u540d\u3092\u4ed8\u3051\u305f\u3064\u3082\u308a\u3067\u3059\u3002\u3067\u3082\u3001\u305d\u3093\u306a\u5927\u305d\u308c\u305f\u3053\u3068\u3092\u8a00\u3046\u3064\u3082\u308a\u306f\u306a\u3044\u3067\u3059\u3002","breadcrumb":{"@id":"https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/dev.activebasic.com\/egtra\/2010\/06\/01\/214\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u30db\u30fc\u30e0","item":"https:\/\/dev.activebasic.com\/egtra\/"},{"@type":"ListItem","position":2,"name":"C++ with GC"}]},{"@type":"WebSite","@id":"https:\/\/dev.activebasic.com\/egtra\/#website","url":"https:\/\/dev.activebasic.com\/egtra\/","name":"\u30a4\u30b0\u30c8\u30e9\u30f3\u30b9\u306e\u982d\u306e\u4e2d","description":"\u982d\u306e\u4e2d\u306e\u304b\u3051\u3089\u3002ActiveBasic\u3092\u4e2d\u5fc3\u306b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u8a71\u3092\u307c\u3061\u307c\u3061\u3068\u3002","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dev.activebasic.com\/egtra\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/dev.activebasic.com\/egtra\/#\/schema\/person\/8de756b2ff20b964f64594dfe8f18164","name":"egtra","sameAs":["https:\/\/x.com\/egtra"],"url":"https:\/\/dev.activebasic.com\/egtra\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/posts\/214"}],"collection":[{"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/comments?post=214"}],"version-history":[{"count":0,"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/posts\/214\/revisions"}],"wp:attachment":[{"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/media?parent=214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/categories?post=214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.activebasic.com\/egtra\/wp-json\/wp\/v2\/tags?post=214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}