Page 1 of 1

I need more memory!

PostPosted: Tue Feb 11, 2014 12:10 am
by Game A Gogo
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?

Re: I need more memory!

PostPosted: Tue Feb 11, 2014 3:44 am
by DarkParadox
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.

Re: I need more memory!

PostPosted: Tue Feb 11, 2014 4:13 am
by Game A Gogo
thanks for the suggestion! Unfortunately the scope trick did not work.. I imagine I need to set this in the source

Re: I need more memory!

PostPosted: Tue Feb 11, 2014 10:56 pm
by skydereign
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.