Problem with Array and OS3.3

A PocketC native palm library offering native forms and assorted utilities

Postby cable_guy_67 on Sun Nov 16, 2003 6:40 pm

I seem to have a problem with some code when it is run on a palmV with OS3.3 Follows is the code that generates the problem:

Code: Select all
pointer prize_list, gameboard;
string data;



// prize_list is 2*4*8 array of prizes to be won with the arch number stored in it.
prize_list = Array("i,2,4,8");

On POSE and an actual device the following is generated
Virtual Machine Error
Addr: 43267
Func: my_function
Global ref out of range

This exact compile works fine on the other 3.5+ Roms and devices I have tested on. It appears that after the 24th call to substr() , (when z goes from 0 to 1) things get hinky. Am I missing something simple? This is the first time I call Array() or substr() in my code.

Thanks for any help.

Posts: 92
Joined: Mon Mar 31, 2003 2:28 am
Location: USA

Postby jstadolnik on Sun Nov 16, 2003 9:06 pm

Your code sample works flawlessly on the emulator using an OS3.3 rom. Your program is likely running out of dynamic heap (scratchpad) memory.

OS3.5+ devices generally have around 192k of heap space, where as pre-OS3.5 devices only have around 36k. If you have a lot of buffers and large arrays around your app is probably using too much heap for OS3.3 (and earlier OS varients). See the HeapSize() PToolbox function and the "Screen Buffers Section" for more details on the dynamic heap.


The PToolboxLib guy.
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby cable_guy_67 on Mon Nov 17, 2003 12:16 am

Thanks Joe, I believe you are correct. I went back and found another programe that I had and it worked fine. Thanks for the info on HeapSize(). I will see how far I am overdrawing the bank and what I can do about it. Back to the drawing board.

Posts: 92
Joined: Mon Mar 31, 2003 2:28 am
Location: USA

Return to Pocket Toolbox

Who is online

Users browsing this forum: No registered users and 2 guests