Re: Deleting nodes in Performer-Linux

New Message Reply Date view Thread view Subject view Author view

From: Joaquín Casillas Meléndez (jcasilla++at++glup.irobot.uv.es)
Date: 02/09/2000 02:20:21


Angus Dorbie wrote:
>
> Joaquín Casillas Meléndez wrote:
> >
> > Hello.
> >
> > I'm trying to delete some nodes in my pfapp at run time in order to free
> > memory. I have tried pfDelete, pfUnrefDelete, pfFree, ..., without
> > succesful. Memory don't seem to be freed at all. I have checked the ref
> > value of the nodes and seems to be right in some cases, but in other the
> > ref count of the node is greater than one and I force it to be zero
> > (pfDelete always returns TRUE).
>
> Forcing to zero will leave a 'dangling pointer', and may cause memory
> corruption of subsequently allocated data when the pointer is ultimately
> referenced. If ref count isn't zero then you should figure out where it
> is being used. You should only unrefdelete if you have incremented the
> ref count for your own purposes. Just pfDelete will work unless you have
> used a performer function to reference the memory, which would
> automatically increment the ref count.
>

  I have checked that after doing 'parent->removeChild(child)' the child
node have 0 parents, and I think its reference count should be 0. When
does the reference count increment its value, in addition to the
'addChild' member function?

> Just how do you know memory isn't being freed?
>

I have seen it in some kind of graphics front-end for the top program.
But I'm sure memory isn't being freed because after 12 or 13 load/delete
calls the app crashes complaining with a segmentation fault: can't
allocate xxxx bytes from the heap (or something similar).

Anyway, I have also checked the /proc/app_pid/status file, and the
memory values are the next:

Before load/delete:

VmSize: 132548 kB
VmLck: 0 kB
VmRSS: 85804 kB
VmData: 124428 kB
VmStk: 296 kB
VmExe: 92 kB
VmLib: 6800 kB

After first load/delete:

VmSize: 134064 kB
VmLck: 0 kB
VmRSS: 84816 kB
VmData: 125800 kB
VmStk: 352 kB
VmExe: 92 kB
VmLib: 6800 kB

After seventh load/delete:

VmSize: 137576 kB
VmLck: 0 kB
VmRSS: 86652 kB
VmData: 129312 kB
VmStk: 352 kB
VmExe: 92 kB
VmLib: 6800 kB

> >
> > The idea is to load/unload models in response to some event. I know the
> > right way to achieve this is by using the pfDBase method, but I think
> > this mechanism is not supported in the current Performer-Linux
> > environment due to pfBuffers (perhaps I'm wrong at this point; please,
> > confirm this).
>
> Currently you are single threaded on Linux and so this is a non issue,
> just create and delete objects as normal and it should just work without
> reference to other buffers. I think buffers should still work.
>

I have run the page.c example program and crashes with segmentation
fault.
I don't know if it is due to pfBuffers.

> Cheers,Angus.

___________________________________________________
 Joaquín Casillas Meléndez Instituto de Robótica
 Polígono de la Coma, s/n. Atdo. 2085 C.P. 46071
 Phone: +34 6 398 3585 Fax: +34 6 398 3550
 Universitat de València Valencia (SPAIN)


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Feb 09 2000 - 02:22:30 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.