<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Why Memory Reak Execute From My Function? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Why-Memory-Reak-Execute-From-My-Function/m-p/655379#M10212</link>
    <description>&lt;P&gt;Have you debugged into this code to see which line triggers the fault?&lt;/P&gt;</description>
    <pubDate>Mon, 17 Mar 2025 12:22:22 GMT</pubDate>
    <dc:creator>Ralph Wessel</dc:creator>
    <dc:date>2025-03-17T12:22:22Z</dc:date>
    <item>
      <title>Why Memory Reak Execute From My Function?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Why-Memory-Reak-Execute-From-My-Function/m-p/654598#M10196</link>
      <description>&lt;P&gt;I'm Programing on ArchiCAD27/Windows10/VisualStudio2019C++&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I Create Element (Object "3DText") by C++;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why My Function Execute Memory Reak in ArchiCAD?&lt;/P&gt;
&lt;P&gt;First Execute = OK&lt;/P&gt;
&lt;P&gt;Second Execute = Memory Reak Execute!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;GSErrCode Create3DText( API_Coord3D pos
, short floorInd
, API_AttributeIndex layer
, API_Guid&amp;amp; obj_guid
, char *ownUnID
, NiArchi::GlobInfo globInfo
) {
GSErrCode res = NOERROR;
API_LibPart libpart = {};
libpart.typeID = APILib_ObjectID;
strcpy(libpart.ownUnID, ownUnID);
//res = ACAPI_LibPart_Search(&amp;amp;libpart, false);
res = ACAPI_LibraryPart_Search(&amp;amp;libpart, false);
if (res == NOERROR) {
API_ParamOwnerType   paramOwner = {};
API_GetParamsType    getParams = {};
paramOwner.libInd = libpart.index;
paramOwner.type.typeID = API_ObjectID;
paramOwner.guid = APINULLGuid;
res = ACAPI_LibraryPart_OpenParameters(&amp;amp;paramOwner);
if (res == NOERROR) {
res = ACAPI_LibraryPart_GetActParameters(&amp;amp;getParams);
if (res == NOERROR) {
API_Element elem = {};
API_ElementMemo memo = {};
//Object初期値取得
elem.header.type.typeID = API_ObjectID;
res = ACAPI_Element_GetDefaults(&amp;amp;elem, &amp;amp;memo);
if (res == NOERROR) {
memo.params = getParams.params;
elem.object.libInd = libpart.index;
elem.object.xRatio = getParams.a;
elem.object.yRatio = getParams.b;
elem.object.pos.x = pos.x;
elem.object.pos.y = pos.y;
if (layer.ToInt32_Deprecated() &amp;gt;= 0) {
elem.header.layer = layer;
}
elem.header.floorInd = floorInd;
double z_btm = globInfo.GetFloorZpos(floorInd);
elem.object.level = pos.z - z_btm;
res = ACAPI_CallUndoableCommand(
GS::UniString("Create Object")
, [&amp;amp;]()-&amp;gt;GSErrCode {
return(ACAPI_Element_Create(&amp;amp;elem, &amp;amp;memo));
});

if (res == NOERROR) {
//成功
obj_guid = elem.header.guid;
}

}//endif
ACAPI_DisposeElemMemoHdls(&amp;amp;memo);
}//endif

}//endif
//CLOSE
if (res == NOERROR) {
res = ACAPI_LibraryPart_CloseParameters();
}
}//endif(res)
if (res != NOERROR) {
//Error Display
}
return(res);
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Mar 2025 09:20:38 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Why-Memory-Reak-Execute-From-My-Function/m-p/654598#M10196</guid>
      <dc:creator>nishida_jp</dc:creator>
      <dc:date>2025-03-11T09:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why Memory Reak Execute From My Function?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Why-Memory-Reak-Execute-From-My-Function/m-p/655379#M10212</link>
      <description>&lt;P&gt;Have you debugged into this code to see which line triggers the fault?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 12:22:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Why-Memory-Reak-Execute-From-My-Function/m-p/655379#M10212</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2025-03-17T12:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Why Memory Reak Execute From My Function?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Why-Memory-Reak-Execute-From-My-Function/m-p/655890#M10213</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;memo.params = getParams.params;&lt;BR /&gt;&lt;BR /&gt;To&lt;BR /&gt;&lt;BR /&gt;ACAPI_DisposeAddParHdl(&amp;amp;memo.params);&lt;BR /&gt;memo.params = getParams.params;&lt;BR /&gt;res = ACAPI_LibraryPart_CloseParameters();&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 23:24:01 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Why-Memory-Reak-Execute-From-My-Function/m-p/655890#M10213</guid>
      <dc:creator>nishida_jp</dc:creator>
      <dc:date>2025-03-17T23:24:01Z</dc:date>
    </item>
  </channel>
</rss>

