-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove heap allocation from netrecv_from #177
Comments
euh, i think the correct fix here is that you don't write into the allocated heap of the network stack? how did you end up making that return a fail on allocation without using that specific heap? EDIT : we are also looking at how its possible you are hitting the limit. are your packets size > 64k ? |
Ow, I see. Thanks for the explanation, i misunderstood how the implementation works.
Yeah, I recorded some recv calls with 65544 of length. I also tried to split the request into multiple smaller requests, which helped in some cases. I will try again now that i know about the hard limit. |
the network heap is 64k in size, so ye if you request packets to be bigger than that it might bump into the error. see how far you can get with that information, and let us know. there might be some things we can do to help the issue, but first see how far you can get in splitting it up! :) |
Maybe you could add a |
Just an update, I tested replacing the direct net_recv calls with: static inline s32 recv_split(s32 s, void *mem, s32 len, u32 flags) {
const s32 LIMIT = 48 * 1024;
s32 max_tries = 1000;
s32 res = 0;
while(len) {
s32 recv_length = len < LIMIT ? len : LIMIT;
s32 recv_call_res = net_recv(s, mem, recv_length, flags);
if (isagain(recv_call_res) && max_tries--)
continue;
else if(recv_call_res < 0)
return recv_call_res;
mem = (char *)mem + recv_length;
len -= recv_length;
res += recv_call_res;
}
return res;
} This seems to solve the allocation issue. Thanks for your support! |
@rafaelsamenezes : do you have any code i can test a libogc change with? im currently working on doing the netrecv_from in blocks, so the user code doesn't need to do it in blocks like you did :) |
Ah that's great. The only example that I have is Retroarch, the build process is a bit convoluted though:
Then start retroarch and open up a game that has achievements. For my tests I use Chrono Trigger with Snes9x2005 core. If you prefer, I can do this test later today (or even generate the build) with your branch. |
that kinda sounds like a lot of setup haha. |
@rafaelsamenezes : did you test it? |
closing due to no response, and because branch is merged |
Feature Request
What feature are you suggesting?
Overview:
Smaller Details:
Nature of Request:
Why would this feature be useful?
Projects that rely on arena allocators can take up the full mem2 space beforehand. This makes network request fail with no memory available even though the provided buffer could be used directly. I did not find any alternatives, please let me known if I am missing something.
For my use case, there is an issue of using retroachievements with retroarch: libretro/RetroArch#16184 (comment)
In my tests, replacing the
netrecv_from
seems to fix the problem.The text was updated successfully, but these errors were encountered: