PxLoadImage with PX_QUERY; memory leak?

Hi folks,

I’m porting my animation view from QNX 4 Photon to QNX 6 Photon. One of the
options I have is a “-d” option, that fetches the images from disk as required,
instead of loading each image on the command line into memory.

This option doesn’t seem to work well under QNX 6 Photon.

I’ve implemented the “-d” option by passing PX_QUERY to the “flags”
member of the “methods” structure that’s passed to PxLoadImage().

Here’s an example of the amount of memory it uses:

980715.gif…dr-xr-xr-x 2 root root 1990656 Oct 08 11:43 /proc
980716.gif…dr-xr-xr-x 2 root root 1843200 Oct 08 11:43 /proc
980728.gif…dr-xr-xr-x 2 root root 1695744 Oct 08 11:43 /proc
980729.gif…dr-xr-xr-x 2 root root 1548288 Oct 08 11:43 /proc
980730.gif…dr-xr-xr-x 2 root root 1400832 Oct 08 11:43 /proc
980731.gif…dr-xr-xr-x 2 root root 1253376 Oct 08 11:43 /proc
980801.gif…dr-xr-xr-x 2 root root 1105920 Oct 08 11:43 /proc


What you see is the filename (e.g., 980715.gif) and the “ls -ld /proc”
output – you can see that each of the GIF files seems to consume about
147k – this is what I would expect if the image was loaded into memory,
instead of just being queried.

Can anyone comment on this? Is there something special or different that
needs to be done in the new version of Photon versus the old? Here’s the
code snippet:

memset (&methods, 0, sizeof (PxMethods_t));
methods.px_alloc = memory_allocate;
methods.px_free = memory_free;
methods.px_warning = warning;
methods.px_error = error;
methods.px_progress = progress;

methods.flags |= PX_QUERY | PX_SUPPRESS_TAG;
for (i = 0; i < nfiles; i++) {
printf ("%s…", fname _);
system (“ls -ld /proc”);
fflush (stdout);
if ((img = PxLoadImage (fname , &methods)) == NULL) {
fprintf (stderr, “%s: error querying %s, errno %d\n”, progname, fname , errno);
perror (NULL);
exit (EXIT_FAILURE);
}
}

I tried it with and without the “PX_SUPPRESS_TAG” ; no change.

Thanks in advance!

-RK

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Consulting and Training at www.parse.com_

Hello Robert

I’ll send you an email with something that should clear this problem up

Thanks
Rodney

nospam94@parse.com wrote:

Hi folks,

I’m porting my animation view from QNX 4 Photon to QNX 6 Photon. One of the
options I have is a “-d” option, that fetches the images from disk as required,
instead of loading each image on the command line into memory.

This option doesn’t seem to work well under QNX 6 Photon.

I’ve implemented the “-d” option by passing PX_QUERY to the “flags”
member of the “methods” structure that’s passed to PxLoadImage().

Here’s an example of the amount of memory it uses:

980715.gif…dr-xr-xr-x 2 root root 1990656 Oct 08 11:43 /proc
980716.gif…dr-xr-xr-x 2 root root 1843200 Oct 08 11:43 /proc
980728.gif…dr-xr-xr-x 2 root root 1695744 Oct 08 11:43 /proc
980729.gif…dr-xr-xr-x 2 root root 1548288 Oct 08 11:43 /proc
980730.gif…dr-xr-xr-x 2 root root 1400832 Oct 08 11:43 /proc
980731.gif…dr-xr-xr-x 2 root root 1253376 Oct 08 11:43 /proc
980801.gif…dr-xr-xr-x 2 root root 1105920 Oct 08 11:43 /proc



What you see is the filename (e.g., 980715.gif) and the “ls -ld /proc”
output – you can see that each of the GIF files seems to consume about
147k – this is what I would expect if the image was loaded into memory,
instead of just being queried.

Can anyone comment on this? Is there something special or different that
needs to be done in the new version of Photon versus the old? Here’s the
code snippet:

memset (&methods, 0, sizeof (PxMethods_t));
methods.px_alloc = memory_allocate;
methods.px_free = memory_free;
methods.px_warning = warning;
methods.px_error = error;
methods.px_progress = progress;

methods.flags |= PX_QUERY | PX_SUPPRESS_TAG;
for (i = 0; i < nfiles; i++) {
printf ("%s…", fname > _);
system (“ls -ld /proc”);
fflush (stdout);
if ((img > = PxLoadImage (fname > , &methods)) == NULL) {
fprintf (stderr, “%s: error querying %s, errno %d\n”, progname, fname > , errno);
perror (NULL);
exit (EXIT_FAILURE);
}
}

I tried it with and without the “PX_SUPPRESS_TAG” ; no change.

Thanks in advance!

-RK

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Consulting and Training at > www.parse.com_

Gui Group <gui@qnx.com> wrote:

Hello Robert

I’ll send you an email with something that should clear this problem up

Could you also post here an explaination?
I’m interested too

Thanks


Thanks
Rodney

nospam94@parse.com > wrote:

Hi folks,

I’m porting my animation view from QNX 4 Photon to QNX 6 Photon. One of the
options I have is a “-d” option, that fetches the images from disk as required,
instead of loading each image on the command line into memory.

This option doesn’t seem to work well under QNX 6 Photon.

I’ve implemented the “-d” option by passing PX_QUERY to the “flags”
member of the “methods” structure that’s passed to PxLoadImage().

Here’s an example of the amount of memory it uses:

980715.gif…dr-xr-xr-x 2 root root 1990656 Oct 08 11:43 /proc
980716.gif…dr-xr-xr-x 2 root root 1843200 Oct 08 11:43 /proc
980728.gif…dr-xr-xr-x 2 root root 1695744 Oct 08 11:43 /proc
980729.gif…dr-xr-xr-x 2 root root 1548288 Oct 08 11:43 /proc
980730.gif…dr-xr-xr-x 2 root root 1400832 Oct 08 11:43 /proc
980731.gif…dr-xr-xr-x 2 root root 1253376 Oct 08 11:43 /proc
980801.gif…dr-xr-xr-x 2 root root 1105920 Oct 08 11:43 /proc



What you see is the filename (e.g., 980715.gif) and the “ls -ld /proc”
output – you can see that each of the GIF files seems to consume about
147k – this is what I would expect if the image was loaded into memory,
instead of just being queried.

Can anyone comment on this? Is there something special or different that
needs to be done in the new version of Photon versus the old? Here’s the
code snippet:

memset (&methods, 0, sizeof (PxMethods_t));
methods.px_alloc = memory_allocate;
methods.px_free = memory_free;
methods.px_warning = warning;
methods.px_error = error;
methods.px_progress = progress;

methods.flags |= PX_QUERY | PX_SUPPRESS_TAG;
for (i = 0; i < nfiles; i++) {
printf ("%s…", fname > _);
system (“ls -ld /proc”);
fflush (stdout);
if ((img > = PxLoadImage (fname > , &methods)) == NULL) {
fprintf (stderr, “%s: error querying %s, errno %d\n”, progname, fname > , errno);
perror (NULL);
exit (EXIT_FAILURE);
}
}

I tried it with and without the “PX_SUPPRESS_TAG” ; no change.

Thanks in advance!

-RK

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Consulting and Training at > www.parse.com_


Wave++