[
https://issues.apache.org/jira/browse/TUSCANY-1552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12804257#action_12804257
]
Thomas Gentsch commented on TUSCANY-1552:
-----------------------------------------
Just tested option b) and let it run with valgrind - the memory leak is gone
and no other errors appeared.
However, I still feel very unsure about this as I mainly use the
DataObject::getList() function to either browse through the instance props or
extracting child SDOs or finally to add child SDOs (using list::append) with
the ref I get using getList().
In all cases the ref is a local variable that lives only temporarily, for
example
func(DataObjectPtr parent, DataObjectPtr child)
{
...
DataObjectList & subDoList = parent->getList(propName);
subDoList.append(child);
}
This use case is safe because the SDO containing the list is "parent" and the
ref "subDoList" disappears after leaving func().
Assuming that most people will use getList() this way option b) seems to be OK.
However I'd like to have some more opinions ...
Assuming that the majority of all users do something like in the example above,
option b) could be made "default" but a compile-time (or even a runtime switch
like a static bool "deleteList" within DataObjectImpl), could be provided for
compatibility (which is of course all very ugly but it seems to me best without
doing option c)
Option a) is even worse because effectively this prevents SDO usage in
long-running progs.
> Severe memory leak in DataObjectImpl.
> -------------------------------------
>
> Key: TUSCANY-1552
> URL: https://issues.apache.org/jira/browse/TUSCANY-1552
> Project: Tuscany
> Issue Type: Bug
> Components: C++ SDO
> Affects Versions: Cpp-M3
> Environment: All
> Reporter: Albert Krzymowski
>
> Memory leak in DataObjectImpl:
> the private listValue member is never:
> initialized, deleted, and copied properly in coping constructors.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.