Skip to content

ibuf: introduce the new method ibuf_shrink#58

Merged
alyapunov merged 2 commits intotarantool:masterfrom
Gumix:ibuf_resize
Jan 27, 2023
Merged

ibuf: introduce the new method ibuf_shrink#58
alyapunov merged 2 commits intotarantool:masterfrom
Gumix:ibuf_resize

Conversation

@Gumix
Copy link
Contributor

@Gumix Gumix commented Jan 13, 2023

It shrinks the buffer to the minimum possible capacity, in order to return the memory to the slab allocator.

Needed for tarantool/tarantool#8108

Do not merge until tarantool/tarantool#8113 is approved!

@locker locker assigned Gumix and unassigned locker Jan 16, 2023
@Gumix Gumix changed the title ibuf: move a part of ibuf_reserve_slow to ibuf_resize ibuf: introduce the new method ibuf_shrink Jan 17, 2023
@Gumix Gumix requested a review from locker January 17, 2023 14:45
@Gumix Gumix assigned locker and unassigned Gumix Jan 17, 2023
@locker locker assigned Gumix and unassigned locker Jan 17, 2023
@Gumix Gumix requested a review from locker January 17, 2023 16:53
@Gumix Gumix assigned locker and unassigned Gumix Jan 17, 2023
locker
locker previously approved these changes Jan 18, 2023
@locker locker removed their assignment Jan 18, 2023
@locker locker self-requested a review January 19, 2023 11:46
@locker locker dismissed their stale review January 19, 2023 11:47

Needs update.

@locker locker assigned Gumix and unassigned alyapunov Jan 19, 2023
@Gumix Gumix requested a review from alyapunov January 19, 2023 14:02
@Gumix Gumix assigned locker and alyapunov and unassigned Gumix Jan 19, 2023
@locker locker assigned Gumix and unassigned locker Jan 19, 2023
@Gumix Gumix removed the do not merge Not ready to be merged label Jan 19, 2023
@Gumix Gumix requested a review from locker January 20, 2023 19:46
@Gumix Gumix assigned locker and unassigned Gumix Jan 20, 2023
@locker locker removed their assignment Jan 23, 2023
@Gumix Gumix assigned Gumix and unassigned alyapunov Jan 26, 2023
@Gumix Gumix assigned locker and unassigned Gumix Jan 27, 2023
@Gumix Gumix requested a review from locker January 27, 2023 14:52
@locker locker assigned alyapunov and unassigned locker Jan 27, 2023
Gumix added 2 commits January 27, 2023 18:35
It computes the actual size of a slab, that will be allocated by slab_get()
for the requested number of bytes.

Needed for tarantool/tarantool#8108
It shrinks the buffer to the minimal possible capacity needed to store
the data written to the buffer and not yet consumed.

Needed for tarantool/tarantool#8108
* less than the real size by slab_sizeof().
*/
size_t
slab_real_size(struct slab_cache *cache, size_t size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided that when we need a method that returns actual capacity of expected slab we will add a one-line slab_real_capacity method.

@alyapunov alyapunov merged commit dd61202 into tarantool:master Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants