Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 A new error! :)
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
copthesaint




PostPosted: Mon Jun 07, 2010 11:19 am   Post subject: A new error! :)

Ok, so for the first time ever, for my self, I have gotten an error that says:
Size of global variables is too big, so I'm guessing i'm sol? lol.
Sponsor
Sponsor
Sponsor
sponsor
USEC_OFFICER




PostPosted: Mon Jun 07, 2010 11:36 am   Post subject: RE:A new error! :)

What number did you put in the variable?
DemonWasp




PostPosted: Mon Jun 07, 2010 11:47 am   Post subject: RE:A new error! :)

It seems like you're trying to allocate a global variable (probably an array) that's too large. Try putting the largest allocation you have inside a procedure instead (so that it's local to the procedure - I know this doesn't do what you want it to do, just do this as a test) and see whether it allows that.

If that doesn't work, try embedding the large array allocation inside a class built to handle that data structure. Allocate an instance of the class as a global, not the array itself. This will allocate that array on the heap, not in the data segment of your program in memory.
chrisbrown




PostPosted: Mon Jun 07, 2010 12:17 pm   Post subject: Re: A new error! :)

If this is related to what you described in the shoutbox, am I right in thinking that you are trying to model a physical environment as a 3D array of points/units? Because if so, that's a massive waste of memory. (If not, sorry for misinterpreting.)

Regardless, multidimensional arrays require a lot of careful planning to be both memory- and cpu-efficient. If you have many elements that are rarely/never accessed, you should probably look for an alternative solution.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: