Homebrew How to use extra memory in had 2.5?

smealum

growing up sucks.
Member
Joined
May 1, 2006
Messages
635
Trophies
2
Age
30
Location
SF
Website
www.smealum.net
XP
2,504
Country
United States
so on n3ds by default you're already getting a ~90MB regular heap (don't remember the exact value, but it's 124MB - code/data - linear heap - 1MB iirc).
the additional 64MB (and 12MB on o3ds) is there but has to be implemented in ctrulib, and that hasn't been done yet due to lack of time.

if you're interested in using that additional memory before it's properly implemented in ctrulib i can give you a quick rundown.
 

elhobbs

Well-Known Member
OP
Member
Joined
Jul 28, 2008
Messages
1,033
Trophies
1
XP
2,622
Country
United States
so on n3ds by default you're already getting a ~90MB regular heap (don't remember the exact value, but it's 124MB - code/data - linear heap - 1MB iirc).
the additional 64MB (and 12MB on o3ds) is there but has to be implemented in ctrulib, and that hasn't been done yet due to lack of time.

if you're interested in using that additional memory before it's properly implemented in ctrulib i can give you a quick rundown.
A run down would be appreciated. I must be doing something wrong as I am only seeing 32 and 24 on my n3ds. I was thinking it might be as simple as adjusting the sizes with a custom __system_allocateHeaps but that is just a guess.
 

smealum

growing up sucks.
Member
Joined
May 1, 2006
Messages
635
Trophies
2
Age
30
Location
SF
Website
www.smealum.net
XP
2,504
Country
United States
A run down would be appreciated. I must be doing something wrong as I am only seeing 32 and 24 on my n3ds. I was thinking it might be as simple as adjusting the sizes with a custom __system_allocateHeaps but that is just a guess.
are you sure you updated your payload to 2.5 ? if you're running 2.5 you should automatically get a 90MB heap.
 

elhobbs

Well-Known Member
OP
Member
Joined
Jul 28, 2008
Messages
1,033
Trophies
1
XP
2,622
Country
United States
are you sure you updated your payload to 2.5 ? if you're running 2.5 you should automatically get a 90MB heap.
I updated ninjhax but was launching themehax. Me being a dumbass. Does the additional memory increase the linear address range or just the heap?
 

smealum

growing up sucks.
Member
Joined
May 1, 2006
Messages
635
Trophies
2
Age
30
Location
SF
Website
www.smealum.net
XP
2,504
Country
United States
I updated ninjhax but was launching themehax. Me being a dumbass. Does the additional memory increase the linear address range or just the heap?
what 2.5 does is set __heap_size to the max it can be given the default linear heap size. by default, this will be used for the regular heap : https://github.com/smealum/ctrulib/blob/master/libctru/source/system/allocateHeaps.c

given this, what you do know is that __linear_heap_size + __heap_size is the maximum amount of memory you should commit. as you can see __system_allocateHeaps is weak, so you can override it in your code to change the way memory is split between the two heaps. just make sure to adjust __libctru_exit as well (cf https://github.com/smealum/ctrulib/blob/master/libctru/source/system/ctru_exit.c )
 

elhobbs

Well-Known Member
OP
Member
Joined
Jul 28, 2008
Messages
1,033
Trophies
1
XP
2,622
Country
United States
what 2.5 does is set __heap_size to the max it can be given the default linear heap size. by default, this will be used for the regular heap : https://github.com/smealum/ctrulib/blob/master/libctru/source/system/allocateHeaps.c

given this, what you do know is that __linear_heap_size + __heap_size is the maximum amount of memory you should commit. as you can see __system_allocateHeaps is weak, so you can override it in your code to change the way memory is split between the two heaps. just make sure to adjust __libctru_exit as well (cf https://github.com/smealum/ctrulib/blob/master/libctru/source/system/ctru_exit.c )
thanks for this. Is there a limit to how much can be used for linear? Just curious - why two memory regions in the first place?
 

smealum

growing up sucks.
Member
Joined
May 1, 2006
Messages
635
Trophies
2
Age
30
Location
SF
Website
www.smealum.net
XP
2,504
Country
United States
thanks for this. Is there a limit to how much can be used for linear? Just curious - why two memory regions in the first place?
afaik you can make the linear buffer as large as you want. the only thing is that there are limitations on the linear buffer that aren't on the regular buffer. for one thing, since the linear buffer is, you know, linear, you'll have limitations on how big single blocks of it can be depending on how fragmented the physical space is. not much of a problem for apps in general, but much more for applets. secondly, there are limitations within the kernel on how linear memory can be used. for example, iirc you can't create shared memory blocks of linear data.

i'm sure there are other reasons but those are the ones that come to mind right now.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • JuanMena @ JuanMena:
    Will you give me mouth to mouth oxygen if my throat closes?
  • K3N1 @ K3N1:
    Nah the air can do that
  • K3N1 @ K3N1:
    Ask @x65943 he's trained for that stuff
  • JuanMena @ JuanMena:
    Kissing random dudes choking in celery? Really? Need to study for that?
  • K3N1 @ K3N1:
    Yes it requires a degree
  • K3N1 @ K3N1:
    I could also yank out the rest of my teeth but theirs professionals for that
  • x65943 @ x65943:
    If your throat closes, putting oxygen in your mouth will not solve anything - as you will be introducing oxygen prior to the area of obstruction
  • JuanMena @ JuanMena:
    Just kiss me Kyle.
  • x65943 @ x65943:
    You either need to be intubated to bypass obstruction or create a stoma inferior to the the area of obstruction to survive
  • x65943 @ x65943:
    "Just kiss me Kyle." And I thought all the godreborn gay stuff was a smear campaign
  • JuanMena @ JuanMena:
    If I die, tell my momma I won't be carrying Baby Jesus this christmas :sad::cry:
  • K3N1 @ K3N1:
    Smear campaigns are in The political section now?
  • JuanMena @ JuanMena:
    Chary! Chary! Chary, Chary, Chary!
  • Sonic Angel Knight @ Sonic Angel Knight:
    Pork Provolone :P
  • Psionic Roshambo @ Psionic Roshambo:
    Sounds yummy
  • K3N1 @ K3N1:
    Sweet found my Wii u PSU right after I ordered a new one :tpi:
  • JuanMena @ JuanMena:
    It was waiting for you to order another one.
    Seems like, your PSU was waiting for a partner.
  • JuanMena @ JuanMena:
    Keep them both
    separated or you'll have more PSUs each year.
  • K3N1 @ K3N1:
    Well one you insert one PSU into the other one you get power
  • JuanMena @ JuanMena:
    It literally turns it on.
  • K3N1 @ K3N1:
    Yeah power supplies are filthy perverts
  • K3N1 @ K3N1:
    @Psionic Roshambo has a new friend
    +1
  • JuanMena @ JuanMena:
    It's Kyle, the guy that went to school to be a Certified man Kisser.
  • Psionic Roshambo @ Psionic Roshambo:
    Cartmans hand has taco flavored kisses
  • A @ abraarukuk:
    hi guys
    A @ abraarukuk: hi guys