Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Oct 18, 2018 7:00 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Runtime error
PostPosted: Wed Feb 22, 2012 8:21 am 
Offline

Joined: Wed May 20, 2009 11:02 am
Posts: 423
Hello,

When the following line is executed I get a runtime error:

ReDim myListBoxSubClass1.myArray(1510,1097,1097)


And the array is a property of myListBoxSubClass that is originally declared as
myArray(-1,-1,-1) as boolean




The error doesn't pop up if I increase the value of the first dimension to 2000, for example:
ReDim myListBoxSubClass1.myArray(2000,1097,1097)


And the error I am getting is:
Microsoft Visual C++ Runtime Library
RunTime Error!

Program:Programname.exe

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

Image
I have tried to reproduce it in a new project with just the declaration plus the redimensioning and it doesn't crash.

There isn't anything too fancy in my project: A listbox subclass with a few properties and methods, buttons, a pagepanel, a timer, a canvas,...

Any idea of what could be causing this? I am working on Windows7 using RB2011r2.

Pixe

_________________
Using RS2011r4.3 on Windows7.


Top
 Profile  
Reply with quote  
 Post subject: Re: Runtime error
PostPosted: Wed Feb 22, 2012 9:00 am 
Offline

Joined: Wed Feb 22, 2012 8:55 am
Posts: 2
i have the exact same problem, except mine doesn't say where the error is occuring. Please help, i have been creating this for 1 month now


Top
 Profile  
Reply with quote  
 Post subject: Re: Runtime error
PostPosted: Wed Feb 22, 2012 9:09 am 
Offline

Joined: Wed May 20, 2009 11:02 am
Posts: 423
Hi Iainfields,

To help other people try to figure out what our problem could be, can you give more details about your project, platform, RB version, ...?

To discover the line that gives the error use break points or run the code line by line (in Steps).

Pixe

_________________
Using RS2011r4.3 on Windows7.


Last edited by pixe656 on Wed Feb 22, 2012 11:39 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Runtime error
PostPosted: Wed Feb 22, 2012 9:50 am 
Offline

Joined: Thu May 03, 2007 2:33 pm
Posts: 289
Apparently it behaves unpredictably due to out-of-memory. The redim tries to reserve space for 1510*1097*1097 elements, which is probably maxing out available RAM (or too close to the limit on a 32bit system maybe).


Top
 Profile  
Reply with quote  
 Post subject: Re: Runtime error
PostPosted: Wed Feb 22, 2012 10:33 am 
Offline

Joined: Fri Dec 01, 2006 3:09 pm
Posts: 650
Location: Tennessee, USA
Considering that the array of 1510*1097*1097 is going to have 1,817,147,590 elements, I am not surprised at all that you are having problems. You say it doesn't give the error if the first dimension is 2000 instead of 1510, but have you actually attempted to run the program with the array being 2000*1097*1097 where it would then have 2,406,818,000 elements? That is one huge array. I have no idea of the internal space each element of a boolean array takes but I doubt that it is a single bit. Do you really expect to have an array that utilizes that many elements? You may need to rethink how you are going to accomplish your goal rather than starting out with some maximum ever possible size that will probably never have all of the elements used.


Top
 Profile  
Reply with quote  
 Post subject: Re: Runtime error
PostPosted: Wed Feb 22, 2012 11:38 am 
Offline

Joined: Wed May 20, 2009 11:02 am
Posts: 423
Thank you for giving it a thought.

trs wrote:
Apparently it behaves unpredictably due to out-of-memory. The redim tries to reserve space for 1510*1097*1097 elements, which is probably maxing out available RAM (or too close to the limit on a 32bit system maybe).

I thought so, but by redimensioning the array to 2000*1097*1097, thus making it larger, the application doesn't crash, and that seems odd. The result is very consistent, always crashing for 1510 and never for 2000 (I have tried a few times with each of them).

harriew wrote:
You may need to rethink how you are going to accomplish your goal rather than starting out with some maximum ever possible size that will probably never have all of the elements used.

I probably have to rethink it, but I am sure all the elements of the array are necessary and will be used. In fact, the dimensions are minimized before redimensioning the array.

In a related thread I was suggested to use a database. Maybe it's time for me to read a little about databases.

I appreciate your help.

Pixe

_________________
Using RS2011r4.3 on Windows7.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group