Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
smiley
Posts: 1,474
Registered: ‎07-14-2008
My Device: Z10

what is max size for pixmap buffer or how to allocate large buffer?

I'm trying to create a large pixmap 500 x 2500 buffer and getting

 

 Not enough memory

 

How do I allocate such large buffer?

 

Please use plain text.
Developer
guru2000at
Posts: 101
Registered: ‎02-25-2011
My Device: Playbook, q5, z10

Re: what is max size for pixmap buffer or how to allocate large buffer?

[ Edited ]

i think the max buffer size 2048 px per side ... 

you have to divide your texture in 2 pieces (500x1250 each piece)  and load it piece by piece ...

 

________________
mappau Dev Team
blackberry@mappau.com
twitter: mappau
Please use plain text.
BlackBerry Development Advisor (Retired)
smacmartin
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: what is max size for pixmap buffer or how to allocate large buffer?

Images have this limit.

You shouldn't be running out of memory for that size.  Perhaps somewhere you have a memory leak or a request for memory using an uninitialized variable, or some some similar problem?

Perhaps the system information perspective will help.

 

Stuart

Please use plain text.
Developer
smiley
Posts: 1,474
Registered: ‎07-14-2008
My Device: Z10

Re: what is max size for pixmap buffer or how to allocate large buffer?

I have the following:

 

1 Screen created with a buffer 600x1024

2 pixmap with the screen resolution 600x1024

 

I'm loading images using img_load_file().

I do not need to free the img_t after loading correct?

 

 

 

Please use plain text.
BlackBerry Development Advisor (Retired)
amarcon
Posts: 155
Registered: ‎07-16-2012
My Device: Dev Alpha

Re: what is max size for pixmap buffer or how to allocate large buffer?

Hi,

 

Yes, you should

 

  • attach to the image library
  • load the image file
  • clean up allocated resources and detach from the image library

So, according to https://developer.blackberry.com/native/reference/com.qnx.doc.libimg.lib_ref/com.qnx.doc.neutrino.li...

 

You pass the address of a structure, it does not allocate it. So if you did a new, you must eventually free it. As usual.

 

See,

 

https://developer.blackberry.com/native/reference/com.qnx.doc.libimg.lib_ref/com.qnx.doc.libimg.lib_...

 

Hope this helps.

Please use plain text.
Developer
smiley
Posts: 1,474
Registered: ‎07-14-2008
My Device: Z10

Re: what is max size for pixmap buffer or how to allocate large buffer?

[ Edited ]

I do detach from the img library after loading the picture.

 

I can load the image fine but the problem is I want to allocate a very large buffer like 2000x2000

 

What I found is that i can allocate pixmap buffers but not a very large one.

Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer

Re: what is max size for pixmap buffer or how to allocate large buffer?

Maybe you could post the code that is allocating the pixmap and failing?

 

Please use plain text.
Developer
smiley
Posts: 1,474
Registered: ‎07-14-2008
My Device: Z10

Re: what is max size for pixmap buffer or how to allocate large buffer?

    screen_pixmap_t lscreen_pix = NULL;
    screen_buffer_t lscreen_pbuf = NULL;
    int rect1[2] = {500, 2500};

    if (screen_create_pixmap(&lscreen_pix, screen_ctx) == 0)
    {
        int format = SCREEN_FORMAT_RGBA8888;
        int usage = SCREEN_USAGE_WRITE | SCREEN_USAGE_NATIVE;

        screen_set_pixmap_property_iv(lscreen_pix, SCREEN_PROPERTY_FORMAT, &format);
        screen_set_pixmap_property_iv(lscreen_pix, SCREEN_PROPERTY_USAGE, &usage);
        if (screen_set_pixmap_property_iv(lscreen_pix, SCREEN_PROPERTY_BUFFER_SIZE, rect1) != 0)
        {
            screen_destroy_pixmap(lscreen_pix);
            return;
        }
        
        if (screen_create_pixmap_buffer(lscreen_pix) == 0)
        {
               // do something

        }

        // error

        else

        {

             return;

        }

 

Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 668
Registered: ‎11-29-2011
My Device: developer

Re: what is max size for pixmap buffer or how to allocate large buffer?

pretty sure you don't need SCREEN_USAGE_NATIVE (or at least I didn't use it in my demos).

SCREEN_USEAGE_READ | SCREEN_USAGE_WRITE should be sufficient.

which call fails for you?  setting SCREEN_PROPERTY_BUFFER_SIZE ?

Please use plain text.
Developer
smiley
Posts: 1,474
Registered: ‎07-14-2008
My Device: Z10

Re: what is max size for pixmap buffer or how to allocate large buffer?

it fails here

 

screen_create_pixmap_buffer(lscreen_pix);

 

and returns out of memory.  thanks

 

Please use plain text.