Closed WerWolv closed 5 years ago
What was the previous libnx version you tested, exactly? Did you try freeing that buffer? And you're sure the buffer was allocated successfully?
When compiling EdiZon with libnx 1.3.0-1, I don't have the issue. Sorry for that misinformation. Freeing the buffer doesn't help either. How can I check if it got allocated correctly? Also, is it possible to see the memory usage of a homebrew app?
Edit: Code with deallocation https://gist.github.com/WerWolv98/f67971f1340c08a466af75cc4d6aefcd
Did you use the same devkitA64 version for current/{previously working}?
Can you get a crash-report?
EDIT: "How can I check if it got allocated correctly?" std::nothrow "memory usage" mallinfo()
DevkitA64 are both on version r12-2 and libcurl is on 7.58.0-1 on the working setup and 7.61.0-2 on the not working one. This is the latest crash log: https://gist.github.com/WerWolv98/fc2d329ef5a6d1f0da1e42ef1c054603
Also I'm not sure if I'm doing this correctly but
u8* data = new(std::nothrow) u8[1024*1024*398];
(void)data;
printf("%lx\n", mallinfo().uordblks);
returns 144101F8
Upload elf for that crash-report?
Are you sure that elf is from the same build as the crash-report?(.text offsets don't make sense)
Oh no sorry. Here is a zip with the latest elf and a crash report from it https://transfer.sh/kZURV/SocketCrash.zip
Still doesn't make sense, are you using latest atmo creport?
Pretty sure. I'm using tomGER's files right now
I'm sorry for this, I made a really stupid mistake in my code and misinterpreted it as a libnx error. The error was caused by me trying to delete a nullptr in a destructor. Issue being, this object is global and therefore deleted by libnx once the homebrew exits.
If around 398MB of heap data got allocated after initializing the socket service using
socketInitializeDefault()
and then eithersocketExit()
got called or the homebrew exits and tries to return to the hbmenu, the Switch crashes with an error code of 2168-0002 (Segmentation Fault).Here's the source code of a PoC homebrew app to demonstrate the issue: https://gist.github.com/WerWolv98/2f57359e72634e33be7d64a07009aa35
It's using libnx version 1.3.2. The issue was NOT present on earlier versions (prior to 1.3.0)