Not enough memory with Ruby 1.9

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Mon Ouïe
Posts: 36
Joined: Sun Jul 05, 2009 10:22 pm

Not enough memory with Ruby 1.9

Post by Mon Ouïe »

Hi,

I'm trying to run Ruby 1.9. The problem I get is a "[FATAL] failed to allocate memory". It seems to be outputed by a xmalloc2. Since Ruby isn't totally initialized, it'd be really strange if we have not enough memory for this. Therefore I belive the problem is in my code.

I have :

Code: Select all

PSP_LARGE_MEMORY = 1
in my code, and no PSP_HEAP_SIZE_KB macros. Should I do anything else in order to fix that ?
Criptych
Posts: 64
Joined: Sat Sep 12, 2009 5:18 am

Re: Not enough memory with Ruby 1.9

Post by Criptych »

Mon Ouïe wrote:I have :

Code: Select all

PSP_LARGE_MEMORY = 1
in my code, and no PSP_HEAP_SIZE_KB macros. Should I do anything else in order to fix that ?
Make sure you do use PSP_HEAP_SIZE_KB (or PSP_HEAP_SIZE_MAX), or your program will be given only the default heap size - I don't know exactly how much that is, but it's not very big.
Mon Ouïe
Posts: 36
Joined: Sun Jul 05, 2009 10:22 pm

Post by Mon Ouïe »

I tried those macros like :

Code: Select all

PSP_HEAP_SIZE_KB(1024 * 32);
And yes, the program run longer. It ends somewhere in ruby_thread_init_stack. It really looks like a lack of memory, but I can't understand how this could take as much memory - therefore, I just belive it doesn't...
Criptych
Posts: 64
Joined: Sat Sep 12, 2009 5:18 am

Post by Criptych »

Mon Ouïe wrote:

Code: Select all

PSP_HEAP_SIZE_KB(1024 * 32);
AFAIK you can't go all the way to 32, since only ~24MB are actually available for programs. Try using 8-16, or if you really need a lot of memory, just use PSP_HEAP_SIZE_MAX, which allocates all available memory for your heap.
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Post by Wally »

Criptych wrote:
Mon Ouïe wrote:

Code: Select all

PSP_HEAP_SIZE_KB(1024 * 32);
AFAIK you can't go all the way to 32, since only ~24MB are actually available for programs. Try using 8-16, or if you really need a lot of memory, just use PSP_HEAP_SIZE_MAX, which allocates all available memory for your heap.
You're better off starting from -256 and heading down.

-256 allocates all but 256kb to your program (some plugins might run in the background blah blah blah)

so

Code: Select all

 PSP_HEAP_SIZE_KB(-256); 
Mon Ouïe
Posts: 36
Joined: Sun Jul 05, 2009 10:22 pm

Post by Mon Ouïe »

Thanks, but it doesn't work either. It hangs at the same point. The result is the same with PSP_HEAP_SIZE_MAX.

Should I trace memory allocation in order to find out if and where there is a problem ?
Post Reply