Free dswifi memory

Post Reply
Posts: 21
Joined: Tue Jun 09, 2009 5:13 am

Free dswifi memory

Post by Jens » Tue Jul 06, 2010 4:48 am

I need to complete clear any memory usage dswifi has allocated after leaving the Wi-Fi part of my app (and then be able to reinitialize it again). Looking through the source for dswifi, I doesn't look like free() is ever called on the heap that's allocated in Wifi_Init.

I did found something in there about using a custom heap. So the two ways I'm considering is:
1. Allocate and set the heap myself and call the init function with WIFIINIT_OPTION_USECUSTOMALLOC
2. When shutting dswifi off, finding the heap struct and call a free() manually

Is there a "right" way to do this?

Posts: 355
Joined: Thu Jul 02, 2009 1:19 pm

Re: Free dswifi memory

Post by elhobbs » Tue Jul 06, 2010 2:48 pm

I do not think there is a "right" way to do this. most apps either turn it on or off- I do not recall any that tried to unload it as well. You may need to do something about the 50ms timer on irq3 on the arm9. also the arm7 stores the address of wifi_data and I think there are some update functions that are called in vblank on the arm7 so you may need to 0 this out on the arm7 as well.

Posts: 1
Joined: Mon Jan 24, 2011 8:06 pm

Re: Free dswifi memory

Post by nil » Mon Jan 24, 2011 8:32 pm

I have the same problem with WIFI memory. My app can init and use the wifi connection for smtp mail now. but after
shutdown and close I thought all is fine. The moment I want to send next mail, system halts. My research is now, that
the heap is increasing till death.
So I tried to reset the wHeap to wHeapFirst. Now I found your remark, but need a litle further help.
The code is written to wifi_arm9 and called after send mail is done:

Code: Select all

void sgIP_free_all(void){
wHeapRecord * rec = wHeapFirst;
while(rec->next) {
wHeapRecord * t = rec;
I thought, that with this function, all dynamic data will be freed, and the heap will start from
wHeapfirst again.

Is there any possible way to solve the growing heap problem?

Posts: 1
Joined: Fri Apr 08, 2011 8:08 pm

Re: Free dswifi memory

Post by Enzomatrx » Fri Apr 08, 2011 8:11 pm

Does anyone have an update for help on this?

I've noticed this as well... subsequent requests seem to build up to the point of the DS Wifi just stopping and locking up the DS.

All debugging just points to a "I'm a Ds. I've stopped".

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest