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
channel_map中元素的空间大小是与fd的值正相关的,而不是跟当前在线的连接数量正相关,这样做是不是有点浪费内存?
int event_loop_handle_pending_add(struct event_loop *eventLoop, int fd, struct channel *channel) { ....... if (fd >= map->nentries) { if (map_make_space(map, fd, sizeof(struct channel *)) == -1) return (-1); } ..... }
int map_make_space(struct channel_map *map, int slot, int msize) { if (map->nentries <= slot) { .... while (nentries <= slot) nentries <<= 1; // 这里申请的内存空间与fd的值正相关 tmp = (void **) realloc(map->entries, nentries * msize); ....... } .... }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
channel_map中元素的空间大小是与fd的值正相关的,而不是跟当前在线的连接数量正相关,这样做是不是有点浪费内存?
The text was updated successfully, but these errors were encountered: