Skip to content

Conversation

@dunglas
Copy link
Member

@dunglas dunglas commented Aug 14, 2025

@AlliBalliBaba
Copy link
Contributor

Looks like go 1.25 will now report leaks in C on program exit see here.

This probably will also pick up interned strings where leaking is intentional.

@dunglas
Copy link
Member Author

dunglas commented Aug 14, 2025

Couldn't we free them on shutdown?

@AlliBalliBaba
Copy link
Contributor

We can probably free those we set ourselves (all zend_strings on phpMainThread), not sure though if the PHP runtime itself frees all memory on shutdown as it might be inefficient.

@AlliBalliBaba
Copy link
Contributor

Seems like only disabling end-of-process leak detection will make ASAN not fail (ASAN_OPTIONS: detect_leaks=0).

Since the PHP main thread is meant as one-instance-per-process, there seems to be a lot of memory that is not explicitly freed at shutdown. Which is understandable since it's inefficient to free everything at the end of the process if the OS will do it for you anyways.

@dunglas dunglas merged commit 5f153e0 into main Aug 18, 2025
58 checks passed
@dunglas dunglas deleted the chore/go-1.25 branch August 18, 2025 08:46
henderkes pushed a commit to static-php/frankenphp that referenced this pull request Sep 11, 2025
* chore: upgrade to Go 1.25

* free all interned strings (test)

* Revert "free all interned strings (test)"

This reverts commit 34823ba.

* Another test.

* Another test

* ASAN_OPTIONS: detect_leaks=0

* Update sanitizers.yaml

* Update sanitizers.yaml

* Update sanitizers.yaml

---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
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