Skip to content
New issue

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

fix memory leak in two_level_iterator #3718

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions db/compact_files_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr,
"SKIPPED as DBImpl::CompactFiles is not supported in ROCKSDB_LITE\n");
return 0;
Expand Down
10 changes: 2 additions & 8 deletions db/compaction_job_stats_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1034,9 +1034,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED, not supported in ROCKSDB_LITE\n");
return 0;
}
Expand All @@ -1045,9 +1043,5 @@ int main(int argc, char** argv) {

#else

int main(int argc, char** argv) {
(void) argc;
(void) argv;
return 0;
}
int main(int /*argc*/, char** /*argv*/) { return 0; }
#endif // !defined(IOS_CROSS_COMPILE)
4 changes: 1 addition & 3 deletions db/compaction_job_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -946,9 +946,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr,
"SKIPPED as CompactionJobStats is not supported in ROCKSDB_LITE\n");
return 0;
Expand Down
4 changes: 1 addition & 3 deletions db/corruption_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as RepairDB() is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions db/cuckoo_table_db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as Cuckoo table is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions db/deletefile_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr,
"SKIPPED as DBImpl::DeleteFile is not supported in ROCKSDB_LITE\n");
return 0;
Expand Down
4 changes: 1 addition & 3 deletions db/external_sst_file_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2006,9 +2006,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr,
"SKIPPED as External SST File Writer and Ingestion are not supported "
"in ROCKSDB_LITE\n");
Expand Down
4 changes: 1 addition & 3 deletions db/obsolete_files_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr,
"SKIPPED as DBImpl::DeleteFile is not supported in ROCKSDB_LITE\n");
return 0;
Expand Down
4 changes: 1 addition & 3 deletions db/options_file_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ int main(int argc, char** argv) {

#include <cstdio>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
printf("Skipped as Options file is not supported in RocksDBLite.\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions db/plain_table_db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1170,9 +1170,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as plain table is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions db/prefix_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -887,9 +887,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr,
"SKIPPED as HashSkipList and HashLinkList are not supported in "
"ROCKSDB_LITE\n");
Expand Down
4 changes: 1 addition & 3 deletions db/repair_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as RepairDB is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions db/wal_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as WalManager is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions db/write_callback_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr,
"SKIPPED as WriteWithCallback is not supported in ROCKSDB_LITE\n");
return 0;
Expand Down
4 changes: 1 addition & 3 deletions table/cuckoo_table_builder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as Cuckoo table is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions table/cuckoo_table_reader_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as Cuckoo table is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions table/two_level_iterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class TwoLevelIterator : public InternalIterator {
InternalIterator* first_level_iter);

virtual ~TwoLevelIterator() {
first_level_iter_.DeleteIter(false);
second_level_iter_.DeleteIter(false);
first_level_iter_.DeleteIter(false /* is_arena_mode */);
second_level_iter_.DeleteIter(false /* is_arena_mode */);
delete state_;
}

Expand Down
6 changes: 1 addition & 5 deletions table/two_level_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ struct TwoLevelIteratorState {
//
// Uses a supplied function to convert an index_iter value into
// an iterator over the contents of the corresponding block.
// arena: If not null, the arena is used to allocate the Iterator.
// When destroying the iterator, the destructor will destroy
// all the states but those allocated in arena.
// need_free_iter_and_state: free `state` and `first_level_iter` if
// true. Otherwise, just call destructor.
// Note: this function expects first_level_iter was not created using arena
extern InternalIterator* NewTwoLevelIterator(
TwoLevelIteratorState* state, InternalIterator* first_level_iter);

Expand Down
4 changes: 1 addition & 3 deletions tools/ldb_cmd_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as LDBCommand is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions tools/reduce_levels_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as LDBCommand is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions tools/sst_dump_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as SSTDumpTool is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions util/auto_roll_logger_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr,
"SKIPPED as AutoRollLogger is not supported in ROCKSDB_LITE\n");
return 0;
Expand Down
4 changes: 1 addition & 3 deletions util/delete_scheduler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -641,9 +641,7 @@ int main(int argc, char** argv) {
}

#else
int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
printf("DeleteScheduler is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions utilities/backupable/backupable_db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1620,9 +1620,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as BackupableDB is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions utilities/blob_db/blob_db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1544,9 +1544,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as BlobDB is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions utilities/checkpoint/checkpoint_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as Checkpoint is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions utilities/column_aware_encoding_exp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ int main() {
}
#endif // GFLAGS
#else
int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "Not supported in lite mode.\n");
return 1;
}
Expand Down
4 changes: 1 addition & 3 deletions utilities/date_tiered/date_tiered_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as DateTieredDB is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions utilities/document/document_db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as DocumentDB is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions utilities/document/json_document_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,7 @@ int main(int argc, char** argv) {
#else
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as JSONDocument is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions utilities/env_timed_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ int main(int argc, char** argv) {
#else // ROCKSDB_LITE
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as TimedEnv is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions utilities/lua/rocks_lua_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -491,9 +491,7 @@ int main(int /*argc*/, char** /*argv*/) {

#else

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
printf("Lua is not supported in RocksDBLite. Ignoring the test.\n");
}

Expand Down
4 changes: 1 addition & 3 deletions utilities/memory/memory_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,7 @@ int main(int argc, char** argv) {
#else
#include <cstdio>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
printf("Skipped in RocksDBLite as utilities are not supported.\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions utilities/object_registry_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ int main(int argc, char** argv) {
#else // ROCKSDB_LITE
#include <stdio.h>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
fprintf(stderr, "SKIPPED as EnvRegistry is not supported in ROCKSDB_LITE\n");
return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions utilities/options/options_util_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,7 @@ int main(int argc, char** argv) {
#else
#include <cstdio>

int main(int argc, char** argv) {
(void) argc;
(void) argv;
int main(int /*argc*/, char** /*argv*/) {
printf("Skipped in RocksDBLite as utilities are not supported.\n");
return 0;
}
Expand Down
Loading