Skip to content

fixed memory leak in func (stmt *Statement) ParseWithSpecialTableName#7420

Closed
ManyakRus wants to merge 2 commits intogo-gorm:masterfrom
ManyakRus:master
Closed

fixed memory leak in func (stmt *Statement) ParseWithSpecialTableName#7420
ManyakRus wants to merge 2 commits intogo-gorm:masterfrom
ManyakRus:master

Conversation

@ManyakRus
Copy link

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

*fixed memory leak in func (stmt Statement) ParseWithSpecialTableName

need fill nil value after using, for prevent memory leak
tables = nil

User Case Description

Gorm function WithContext() have big memory leak.
In golang version 1.2.21 my request solve all problems with memory leak.
in golang version higher gorm have another new one memory leak.

@last-warrior
Copy link

how is this fixing memory leak ? You have commented out tables=nil . Now it's just expanded if condition.

@ManyakRus
Copy link
Author

my fix not fix memeory leak i think :-(
i am sorry
it worked at first, but not now.

however Gorm function WithContext() have big memory leak.
I deleted WithContext() everywhere and problem fixed for me, but it is not good solve

@jinzhu
Copy link
Member

jinzhu commented May 23, 2025

WithContext doesn't leak memory, maybe the ctx you created leaks

@jinzhu jinzhu closed this May 23, 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