Memory Leak when RemoveTag()
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/04/2008 at 09:13, xxxxxxxx wrote:
Doesn't that require getting the NodeData (i.e.: tag->GetNodeData()->Free())? If I do something like this: MyTag::Free(tag), I get an "illegal call of non-static member function" error (which makes sense since it is not declared static anywhere in the NodeData or derived class).
Normally, I use the PluginTag::Free() which is declared static. There is no example using the PluginTag class in conjunction with the TagData class (for instance).
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/04/2008 at 09:28, xxxxxxxx wrote:
You are right Robert. What I actually meant was you have to use the base class of the tag, for instance TextureTag, PluginTag etc.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/04/2008 at 09:28, xxxxxxxx wrote:
OK i tried this before, but then Cinema crashes. Maybe i post more of my code:
class MyTag : public TagData { ... } BaseTag* tag = op->MakeTag(ID_MYTAG); tag->Remove(); BaseTag::Free(tag);
When i try this, cinema crashes ...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/04/2008 at 09:34, xxxxxxxx wrote:
It should be something like this:
>
\> PluginTag \*tag = (PluginTag\* )op->MakeTag(ID_MYTAG); \> if(tag) \> { \> tag->Remove(); \> PluginTag::Free(tag); \> } \>
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/04/2008 at 09:36, xxxxxxxx wrote:
If you get a compiler error, cast the tag:
PluginTag:Free((PluginTag*&)tag);
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/04/2008 at 12:53, xxxxxxxx wrote:
THX
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/04/2008 at 12:23, xxxxxxxx wrote:
Another problem occured. I did it like Matthias told me, but with a little extension. There is a function which adds the tag with
PluginTag *tag = (PluginTag* )op->MakeTag(ID_MYTAG);
Another function should kill the tag and tries to do this with
PluginTag *tag = (PluginTag* )op->GetTag(ID_MYTAG); tag->Remove(); PluginTag::Free(tag);
When i add the last line PluginTag::Free(tag) Cinema crashes. Any ideas? I also tried:
PluginTag *tag = (PluginTag* )op->GetTag(ID_MYTAG); op->KillTag(ID_MYTAG);
with the same result....
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/04/2008 at 13:31, xxxxxxxx wrote:
if (!tag) // don't do anything
If there is no tag retrieved by GetTag(), that could be problematic.
If tag isn't NULL and the code is only crashing on PluginTag::Free(tag), then you'd better check your tag's Free() method for possible bad memory deallocations or illegal calls.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/04/2008 at 15:39, xxxxxxxx wrote:
Where are you freeing the tag? And what is "op"? In some threaded functions it is not allowed to modify the scene and if op is in the scene this may be what causes the crash.
Otherwise, as stated by the others, you must be missing another memory allocation as the code is fine (except for the pointer checks but let´s assume all objects are there).
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/04/2008 at 04:54, xxxxxxxx wrote:
Sorry guys,
wasn't there last week. I tried what you told me but the problem is still there. The thing is that the problem only occures when i allocate the tag in one function an free it in another. When i free it in the same function everything is fine ( but this doesn't make sense )
cheers
Peter -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/04/2008 at 05:15, xxxxxxxx wrote:
where are you allocating/freeing it exactly? What is the name of the functions? Is it your own functions? Where are you storing the pointer of the allocated tag?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/04/2008 at 10:35, xxxxxxxx wrote:
I think more code would be warranted here. Since this is odd behavior, a small snippet doesn't provide the context necessary to answer Samir's questions in the previous post.
It could be a threaded situation or a situation where the scene must not be modified or you could be working with a cloned object (ModifyObject() or some render method). Hard to say without more information.