08-29-2012 08:13 PM
I'm trying to create a large pixmap 500 x 2500 buffer and getting
Not enough memory
How do I allocate such large buffer?
08-30-2012 12:24 PM - edited 08-30-2012 12:25 PM
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 ...
08-30-2012 03:19 PM
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
08-30-2012 04:54 PM
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?
09-05-2012 03:49 PM
Hi,
Yes, you should
So, according to https://developer.blackberry.com/native/reference/
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,
Hope this helps.
09-05-2012 06:31 PM - edited 09-05-2012 06:32 PM
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.
09-05-2012 11:35 PM
Maybe you could post the code that is allocating the pixmap and failing?
09-06-2012 10:37 AM
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;
}
09-06-2012 12:03 PM
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 ?
09-06-2012 12:04 PM
it fails here
screen_create_pixmap_buffer(lscreen_pix);
and returns out of memory. thanks