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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 1,638
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

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?

 

Developer
Posts: 101
Registered: ‎02-25-2011
My Device: Playbook, q5, z10
My Carrier: TM

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
Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: 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

Developer
Posts: 1,638
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

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?

 

 

 

Retired
Posts: 155
Registered: ‎07-16-2012
My Device: Dev Alpha
My Carrier: Bell

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.

Developer
Posts: 1,638
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

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.

Highlighted
BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

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?

 

Developer
Posts: 1,638
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

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;

        }

 

BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

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 ?

Developer
Posts: 1,638
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

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