We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
version: gorocksdb@v1.6.36
function: write_batch.go
func (wb *WriteBatch) Put(key, value []byte) { cKey := byteToChar(key) cValue := byteToChar(value) C.rocksdb_writebatch_put(wb.c, cKey, C.size_t(len(key)), cValue, C.size_t(len(value))) }
use case:
func writeLargeObjects(db *grocksdb.DB) { for i := 0; i < 1000; i += 10 { writeLargeObjectsCore(db, i, i+10) } } func writeLargeObjectsCore(db *grocksdb.DB, l, r int) { largeValue := make([]byte, 1*1024*1024) // 1MB bytes for i := range largeValue { largeValue[i] = 'x' } batch := grocksdb.NewWriteBatch() for i := l; i < r; i++ { key := fmt.Sprintf("large_key_%d", i) batch.Put([]byte(key), largeValue) } writeOpts := grocksdb.NewDefaultWriteOptions() err := db.Write(writeOpts, batch) if err != nil { log.Fatalf("Write failed: %v", err) } writeOpts.Destroy() batch.Destroy() }
results: By this use case, memory leak will happen. The VmRSS is much larger than Go sys memory and rocksdb-memtable and rocksdb-block-cache.
The text was updated successfully, but these errors were encountered:
@AaronLin98
v1.6.36 is outdated. I highly recommend upgrading both RocksDB & grocksdb to newer version and give it another try.
Sorry, something went wrong.
I have tried the new version, it seems like cgo has some problem for memory leak
Sorry for late reply due to personal matter. Have you tried:
writebatch.Clear()
writebatch.Destroy()
No branches or pull requests
version: gorocksdb@v1.6.36
function: write_batch.go
use case:
results:
By this use case, memory leak will happen.
The VmRSS is much larger than Go sys memory and rocksdb-memtable and rocksdb-block-cache.
The text was updated successfully, but these errors were encountered: