Skip to content

Commit

Permalink
Fix when executing table::free() before process exit, it causes mut…
Browse files Browse the repository at this point in the history
…ex lock not work in other processes. see https://github.com/swoole/benchmark/blob/master/table.php [random_rw test]
  • Loading branch information
matyhtf committed Nov 6, 2024
1 parent 3d8abe6 commit 0c6b552
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 13 deletions.
4 changes: 0 additions & 4 deletions ext-src/swoole_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ static void inline php_swoole_table_set_ptr(zval *zobject, Table *ptr) {
}

static inline void php_swoole_table_free_object(zend_object *object) {
Table *table = php_swoole_table_fetch_object(object)->ptr;
if (table) {
table->free();
}
zend_object_std_dtor(object);
}

Expand Down
2 changes: 0 additions & 2 deletions include/swoole_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ class Table {
TableRow *get(const char *key, uint16_t keylen, TableRow **rowlock);
bool del(const char *key, uint16_t keylen);
void forward();
// only release local memory of the current process
void free();
// release shared memory
void destroy();

Expand Down
7 changes: 0 additions & 7 deletions src/memory/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ Table *Table::make(uint32_t rows_size, float conflict_proportion) {
return table;
}

void Table::free() {
delete mutex;
delete iterator;
delete column_map;
delete column_list;
}

bool Table::add_column(const std::string &_name, enum TableColumn::Type _type, size_t _size) {
if (_type < TableColumn::TYPE_INT || _type > TableColumn::TYPE_STRING) {
swoole_warning("unknown column type");
Expand Down

0 comments on commit 0c6b552

Please sign in to comment.