Re: [info-performer] pfdNewGeom doesn't want to allocate memory

Date view Thread view Subject view Author view

From: Allan Schaffer (allan++at++sgi.com)
Date: 06/03/2004 16:30:38


Hi Simon,

Simon Perreault wrote:
> In writing my own heavily modified 3DS loader, I used the pfdNewGeom()
> function to create a new pfdGeom object:
>
> pfdGeom* facet = NULL;
> facet = pfdNewGeom(3);
>
> Inspecting the allocated object with a debugger, I see that facet has
> been correctly allocated, but its members haven't. For example,
> facet->numVerts is 0 and facet->coords is NULL. How is this possible?
>
> As I am working on Windows, I immediatly suspected that something had
> gone awry in the shared arena department. Indeed, pfGetSharedArena()
> returns NULL. Is that to be expected on Windows? Even if that was a
> problem, how does facet get successfully allocated when it is also
> allocated on the stack? More troubling: why does numVerts get set to
> zero? Debugging with MSVC, I haven't found out how to step into the
> pfdNewGeom function, of which I am supposed to have the source.

No answer here for your overall problem but a few pointers that might set
things in the right direction:

  - It's normal for pfGetSharedArena() to return NULL on windows.
    Sending the NULL arg to pfMalloc(num, size, NULL) just tells
    Performer to allocate from the stack.
  - Very bizarre that e.g. facet->numVerts comes back 0. No idea
    why that would occur in fact; makes me wonder if optimization
    is confusing the debugger somehow. Maybe try with the debug
    Performer libs?
  - Source for pfdNewGeom (and all of libpfdu) is shipped with
    Performer: /usr/share/Performer/src/lib/libpfdu/pfdGeoBuilder.c,
    or %PFROOT%/src/lib/libpfdu/pfdGeoBuilder.c

Good luck,
Allan

-- 
Allan Schaffer                                            allan++at++sgi.com
Engr. Dept. Manager, Visual Systems Group                1-650-933-2160
Silicon Graphics                                     http://www.sgi.com


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Jun 03 2004 - 16:31:00 PDT