- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
5m memory leak?why? (api_del_e ntity caused)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-26-2009 12:37 AM
he following simple code of ACIS seems having 5m memory leak?why?
can someone help?
void TestIt()
{
for (int j = 0; j < 3000; j++)
{
SPAposition pos1(0,0,0);
SPAposition pos2(10,10,10);
BODY* pBody2 = NULL;
api_solid_block(pos1, pos2, pBody2);
if (pBody2)
{
api_del_entity(pBody2);
pBody2 = NULL;
}
}
}
Re: 5m memory leak?why? (api_del_e ntity caused)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-26-2009 12:40 AM
什么原因呢?
什么原因呢?
什么原因呢?
什么原因呢?
什么原因呢?
Re: 5m memory leak?why? (api_del_e ntity caused)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-26-2009 12:43 AM
The above code is tested on ACIS 13.0. Thanks.
Re: 5m memory leak?why? (api_del_e ntity caused)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-29-2009 05:01 AM
We have tested a similar code earlier and did not find memory leaks...However after further probing what we learnt that customers were concerned about the process memory increasing inspite of deleting the entity. They may be due to the following
1)By default the ACIS history manager is on...so every change you make to the body is stored in the bulletin board...In this case there is create and delete bulletin. Please see http://doc.spatial.com/r19/index.php/Bulletin_Boar
2) In debug build the annotations are on by default...so if you are seeing this in then that can be another reason for this behavior.Please see http://doc.spatial.com/r19/index.php/Option:Annota
Here is the list of discussion on similar topics.
http://forums.spatial.com/t5/forums/searchpage/boa
In addition to that please note R13 is no longer a supported version by Spatial. Please upgrade to R19SP3.
Re: 5m memory leak?why? (api_del_e ntity caused)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-07-2009 08:05 PM
Thanks for ybiyani. It is solved. 非常感谢!
The following 3 line codes are the most important in the following program.
api_set_int_option("annotations", 0); //seems it does not function. maybe because of degbug mode
api_logging (0);
api_clear_annotations();
void TestIt()
{
for (int j = 0; j < 3000; j++)
{
SPAposition pos1(0,0,0);
SPAposition pos2(10,10,10);
BODY* pBody2 = NULL;
api_solid_block(pos1, pos2, pBody2);
if (pBody2)
{
AcisOptions o;
api_del_entity(pBody2, &o);
pBody2 = NULL;
api_clear_annotations();
}
}
}
int main(int argc, char* argv[])
{
api_start_modeller(0);
api_initialize_kernel();
api_set_int_option("annotations", 0);
api_logging (0);
TestIt();
api_terminate_kernel();
api_stop_modeller();
return 0;
}
Re: 5m memory leak?why? (api_del_e ntity caused)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-23-2009 06:37 AM
One thing to note is that when api_logging is set to FALSE, it means that the application is now taking responsibility of managing the entities created through the entitie's life cycle. So, to avoid memory leaks in this case, it becomes very crucial for the application to call api_del_entity or api_del_entity_list to free up the memory. Where as if the api_logging is TRUE, ACIS automatically manages the memory used by each entity created.

