X/Allocation problem (SGI O2 - IRIX6.3)

X/Allocation problem (SGI O2 - IRIX6.3)

Post by Antonio Scott » Tue, 21 Jul 1998 04:00:00



Hi,
I am developing an application which until very recently has given no
problems of this kind.
However in the last few days each time the programs does the following
sequence of calls:

 SoundPixmap = XCreatePixmap( pdisp,
                        RootWindow( pdisp, m_pXVisInfo->screen ),
                        iColWidth,
                        iBmpPixels,
                        m_pXVisInfo->depth );

GLXPixmap glxPix = glXCreateGLXPixmap( pdisp, m_pXVisInfo, SoundPixmap
);

glXMakeCurrent( pdisp, glxPix, ctx );

an allocation error occurs:

  X  Error of failed request:  BadAlloc (insufficient resources for
operation)
  Major opcode of failed request:  53 (X_CreatePixmap)
  Serial number of failed request:  26969
  Current serial number in output stream:  27115

then a system message appears:

ALERT: Xsgi [1181] - out of logical swap space during brk/sbrk - see
swap(1M)

and, of course, the program crashes!

This has never happened before with the same program and I can only
assume there is some memory leak that produces this behavior.

I tried also checking system parameters while the program executes and
there is nothing really suspicious as with regards swap space, or user
data and free memory.

One other thing which I noted, was that if I reboot my machine and start
up again this same problem doesn't reproduce itself immediatly but after
two or three trials of using the piece of code above.

There are other parts of this code that rely on dmBuffers, which are
initialized at program start-up. Each time I run the program from the
Workshop de* it just crashes with the same set of messages when it
reaches the piece of code that allocates the dmBuffers doing something
like:

CBufferCache::CBufferCache( Display* dpy ) {

    int i;

    // Set the global CBufferCache pointer

    theBufferCache = this;

    // Init DM

    DMparams* dmParams;
    DMparams* poolParams;

    dmParamsCreate (&dmParams);
    dmSetImageDefaults (dmParams, bufferSize, bufferSize,
        DM_IMAGE_PACKING_RGBA);
    dmParamsSetEnum (dmParams, DM_IMAGE_LAYOUT,
DM_IMAGE_LAYOUT_GRAPHICS);

    dmParamsCreate (&poolParams);
    dmBufferSetPoolDefaults (poolParams, numBuffers,
        (((bufferSize * bufferSize * 4) + 0xffff) & ~0xffff), DM_FALSE,
        DM_FALSE);
    dmBufferGetGLPoolParams (dmParams, poolParams);

    // Try to allocate the pool as usual...

    if (dmBufferCreatePool (poolParams, &_dmpool) == DM_FAILURE)
    {
        // If it fails, chew up some RAM and release it, then try the pool
        // allocation again.

        if (!Squeeze(numBuffers*bufferSize*bufferSize*4))
        {
            // Fatal error
        }

        if (dmBufferCreatePool (poolParams, &_dmpool) == DM_FAILURE)
        {
            // Fatal error.
        }
    }

    for (i = 0; i < numBuffers; i++)
        dmBufferAllocate (_dmpool, &_dmbuffers[i]);

.....

Quote:}

When I don't execute the program from the Workshop de* though, this
last problem happens only rarely, and there is no system messageof the
kind:

ALERT: Xsgi [1181] - out of logical swap space during brk/sbrk

Well, any help would be deeply appreciated.
Cheers,
-- Antonio
============================================================
Antonio Scotti                  
Video Efecto S.A., I+D          http://www.veryComputer.com/
c/Alegre de Dalt 86, bajos      Tel: 34 3 213 56 16
08024 Barcelona, Spain          Tel: 34 3 285 13 04
                                Fax: 34 3 219 77 59
============================================================

 
 
 

X/Allocation problem (SGI O2 - IRIX6.3)

Post by Nhi Van » Tue, 21 Jul 1998 04:00:00



Quote:

>Hi,
>I am developing an application which until very recently has given no
>problems of this kind.
>However in the last few days each time the programs does the following
>sequence of calls:

> SoundPixmap = XCreatePixmap( pdisp,
>                    RootWindow( pdisp, m_pXVisInfo->screen ),
>                    iColWidth,
>                    iBmpPixels,
>                    m_pXVisInfo->depth );

>GLXPixmap glxPix = glXCreateGLXPixmap( pdisp, m_pXVisInfo, SoundPixmap
>);

>glXMakeCurrent( pdisp, glxPix, ctx );

>an allocation error occurs:

>  X  Error of failed request:  BadAlloc (insufficient resources for
>operation)
>  Major opcode of failed request:  53 (X_CreatePixmap)
>  Serial number of failed request:  26969
>  Current serial number in output stream:  27115

>then a system message appears:

>ALERT: Xsgi [1181] - out of logical swap space during brk/sbrk - see
>swap(1M)

>and, of course, the program crashes!

>This has never happened before with the same program and I can only
>assume there is some memory leak that produces this behavior.

Its (XCreatePixmap) tried to malloc some space and failed, that doesn't
mean there is a memory leak. It may just mean that you are trying to
malloc too much.

Have you tried printing the iColWidth, iBmpPixels and m_pXVisInfo->depth
values to make sure they are reasonable ?

Run it synchronously from a debuuger and stop in _XError, you should be
able to work out how much its trying to malloc.

richard.
--
Richard M. Offer        Widget FAQ --> http://reality.sgi.com/widgetFAQ
MTS-Core Design (Motif)
___________________________________________http://reality.sgi.com/offer

 
 
 

1. GL app on O2/Irix6.5

I'm supporting an event-driven GL application that currently runs on
Indy's & Iris 4G's (yep, old & rickety) under Irix 5.3.  We're porting
it to an O2/Irix6.3.

One graphics feature is not updating properly under user control.  It's
a simple line object that should move when the cursor is dragged over a
control area.  The underlying values are updated, but the image does not
change during the mouse-drag.  Also, it seems to be a matter of hardware
as well as software.  The feature does work when executing on the O2,
but displaying remotely on an Indy.

Following the call stack as low as I can, it seems to come down to a
call to "callobj", which should execute for each incremental move of the
cursor.  When I try to trace into "callobj", I get a message informing
me of the library WorkShop is trying to enter.  (Of course, the symbolic
debugging isn't available, but I do get the name of the library.)

Depending on the system _displaying_ the application, the library name
is different.  On the O2, it's <./iglooIGLOO.D/gl_if.s>,  On an Indy
5000, it's <./NEWPORTNEWTON.D/gl_if.s>.  On an Indy 4400, it's
<.NEWPORTNG1.D/gl_if.s>.

My low-level knowledge of the graphics engine is limited at best, but
I'm guessing the library is some kind of local interface to the graphics
hardware.

Any info out there on this kind of porting issue?  Any programming
tricks that might help?

Thanks!

--
------------------------------------------------------
"A computer lets you make more mistakes faster than
 any invention in human history, with the possible
 exceptions of handguns and tequila." --Jose ClueErvo
------------------------------------------------------
* Russ Leach * 978-858-1117 * Dept 7164 * M/S T3MR5  *

2. I need some help recognizing patterns in bmp images...

3. O2 IRIX6.5 video input

4. I/O + Graphics

5. mvClose() on O2/R10k(174MHZ)/IRIX6.3

6. 3D Hough transform

7. Problem: Connecting SGI O2 with Epson projector

8. Will output anims to tape: Very Cheap.

9. SGI O2 mediarecorder problem

10. [= SGI O2 X/Font problem - Need Help! =]

11. GLX Pixmap problem on SGI O2

12. Performance problems porting from SGI O2 to NT