I need more memory!

You must understand the Game Editor concepts, before post here.

I need more memory!

Postby Game A Gogo » Tue Feb 11, 2014 12:10 am

Hello everyone! I recently picked up game editor while being bored and decided to do some double linked list... I'm testing it's efficiency and using structs of 40972 bytes (40kB~) for each node and adding one node every frame, but pretty quickly I get an error saying I'm trying to use too much memory and I can write something like "gedMaxGameMem=134227235;" before the allocation of the memory... but we all know how GE hates you having non-declarative code before you declare your variables...

So what's my solution to be able to use more memory?
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: I need more memory!

Postby DarkParadox » Tue Feb 11, 2014 3:44 am

I don't have a solution for your memory problem, as I'm not sure how I would go about breaking that gigabyte of memory limit (it may be a arbitrary hard-coded limit in GE that was forgotten about?) but you can use empty scopes to declare variables after non-declarative code in GE (but it will be stuck inside of the scope, of course).
E.g. useless but functional code:
Code: Select all
xvelocity = 0;

{
  int i = 5;
  xvelocity = i;
}


So in your case you could do something like:
Code: Select all
if_or_function_or_whatever() {
  gedMaxGameMem=134227235;
  {
    // Var declarations
    // Allocation
    // Etc.
  }
}

Or hey, just a #define. There's no restriction as to where you #define or #undef in C as you probably already know, so that's something.

Hope this helps in some way, even as just a heads up.
User avatar
DarkParadox
 
Posts: 457
Joined: Mon Jan 08, 2007 11:32 pm
Location: USA, Florida.
Score: 84 Give a positive score

Re: I need more memory!

Postby Game A Gogo » Tue Feb 11, 2014 4:13 am

thanks for the suggestion! Unfortunately the scope trick did not work.. I imagine I need to set this in the source
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: I need more memory!

Postby skydereign » Tue Feb 11, 2014 10:56 pm

Interesting. It's set in gameEngine/EiC/src/ymem.c.
Code: Select all
unsigned long gedMaxGameMem = 128*1024*1024;

That isn't much space... Though you should be able to set it in the view's create actor to something much higher (at least according to the error message). I've never run into that myself though so I don't know what is needed to make it actually work.

-Edit
The setting of gedMaxGameMem does actually work. You just need to make sure to set it in an event prior to where you are allocating the memory.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest