Skip to content

(obsolete) Update TBB, dependencies and alandtse CommonLibSSE-NG#69

Open
AndbGame wants to merge 11 commits intoaers:masterfrom
AndbGame:update
Open

(obsolete) Update TBB, dependencies and alandtse CommonLibSSE-NG#69
AndbGame wants to merge 11 commits intoaers:masterfrom
AndbGame:update

Conversation

@AndbGame
Copy link

For now it is just experiment. For discussion, review, testing.

  • update vcpkg baseline
  • migrate to alandtse CommonLibSSE-NG
  • tbbmalloc 2022.1.0
  • only for 1.6.1170

Main goal: an attempt to solve the CTD like

PROBABLE CALL STACK:
    [ 0] 0x7FF9AAA25A9B tbbmalloc.dll+0015A9B
    [ 1] 0x7FF9AAA2372E tbbmalloc.dll+001372E

have suspicion that tbbmalloc (v2020.3) has thread race, I am found some fixes in (v2021.11.0)

I am already have few positive feedbacks, that this resolve such CTD (some guys very often encountered such a crash when loading some of his saves. so maybe the experiment was not in vain). And testing in real gameplay still in progress

@AndbGame
Copy link
Author

Fail :( Infinity loop in tbb 2022.1.0

image

@AndbGame
Copy link
Author

Ok. after deeper investigate and testing, looks I am stuck for select better version of tbbmalloc
both versions (v2020.3 and 2022.1.0) looks work fine in most cases, but

  • with tbbmalloc (v2020.3) sometimes users can catch CTD (and in most cases, this is an extremely rare occurrence, but there are examples where they have happened frequently and in this case 2022.1.0 resolve such CTD.)
  • with tbbmalloc (2022.1.0) I caught freeze once ((obsolete) Update TBB, dependencies and alandtse CommonLibSSE-NG #69 (comment)). and not sure that users able report about freezes (because not have CTD)

I am personally now playing/testing with rpmalloc instead tbbmalloc (AndbGame#2)
But it is more for experiments - not see any advantages. But I am catсh one time CTD in rpmalloc - and again looks it is

  • or thread race (Which I'm already very doubtful about.)
  • or some threads write to incorrect address of memory (bugged mod/some dll, wrong offsets, etc..)

Therefore, I will leave this MR at your discretion - it can at least be useful for switching to alandtse CommonLibSSE-NG, but at the moment I have no idea which library (and which version) to select for memory allocation.

@AndbGame AndbGame marked this pull request as ready for review May 28, 2025 19:21
@AndbGame
Copy link
Author

AndbGame commented Jun 3, 2025

Fail :( Infinity loop in tbb 2022.1.0

image

uxlfoundation/oneTBB#1737

Not resolved

@AndbGame
Copy link
Author

AndbGame commented Jun 3, 2025

also added debug log - 32651b1

to at least detect the problem area in formcaching (vary rare for me) - but problem also not resolved

@aers
Copy link
Owner

aers commented Aug 19, 2025

Hey

We talked in discord so you know I've rewritten EF myself to use newer commonlib etc, but leaving this PR open for now to discuss some stuff

With regards to form cache, I think it will probably be safe if the form is verified to have the correct formid (like you did in the debug log), and also clear cache entirely on load game start using skse load event.

For double frees I don't really have a solution outside of try and fix them in Skyrim's code, but that requires tracking them down.

The project now has a cmake preset for using tbb and not using tbb (which just uses crt malloc). With a large modlist, tbb's malloc reduced my startup time by 13% from 107 seconds to 95 seconds, so there's definitely some benefit in continuing to include it. I am curious what happens with double frees using system alloc, Wish there was a way to trigger it reliably.

One thing to note is that Skyrim's default memory manager simply allocs a large heap and then manages the heap internally and no longer makes calls to malloc/free. This obviously means that if Skyrim has use after free or heap overflows it won't crash because the allocated memory still exists, it will just end up with undefined behavior. The EF memory manager replacement actually causes the game to crash without EF's other fixes (see MemoryAccessErrors) because of this. I'd love to be able to track down any other such errors in the game but it's difficult if they're rare.

@AndbGame AndbGame changed the title Update TBB, dependencies and alandtse CommonLibSSE-NG (obsolete) Update TBB, dependencies and alandtse CommonLibSSE-NG Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants