Skip to content

Commit

Permalink
don't eagerly remove golang gc references in Destroy
Browse files Browse the repository at this point in the history
1. it's not necessary
2. user may want to keep reference it indirectly

ref: linxGnu#172
  • Loading branch information
yihuang committed Feb 24, 2025
1 parent a795733 commit 249677e
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 8 deletions.
2 changes: 0 additions & 2 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -2781,8 +2781,6 @@ func (opts *Options) Destroy() {
C.rocksdb_env_destroy(opts.env)
opts.env = nil
}

opts.bbto = nil
}

type LatestOptions struct {
Expand Down
1 change: 1 addition & 0 deletions options_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,5 @@ func (b *BackupEngineOptions) GetShareFilesWithChecksumNaming() ShareFilesNaming
// Destroy releases these options.
func (b *BackupEngineOptions) Destroy() {
C.rocksdb_backup_engine_options_destroy(b.c)
b.c = nil
}
2 changes: 0 additions & 2 deletions options_block_based_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ func newNativeBlockBasedTableOptions(c *C.rocksdb_block_based_table_options_t) *
func (opts *BlockBasedTableOptions) Destroy() {
C.rocksdb_block_based_options_destroy(opts.c)
opts.c = nil
opts.cache = nil
opts.compCache = nil
}

// SetChecksum sets checksum types.
Expand Down
4 changes: 0 additions & 4 deletions options_read.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,6 @@ func (opts *ReadOptions) GetIOTimeout() uint64 {
func (opts *ReadOptions) Destroy() {
C.rocksdb_readoptions_destroy(opts.c)
opts.c = nil
opts.iterUpperBound = nil
opts.iterLowerBound = nil
opts.timestamp = nil
opts.timestampStart = nil
}

// SetTimestamp sets timestamp. Read should return the latest data visible to the
Expand Down

0 comments on commit 249677e

Please sign in to comment.