Skip to main content
Code Review

Return to Answer

Commonmark migration
Source Link

###Inuse stack purpose?###

Inuse stack purpose?

I'm not sure what purpose your inuse stack serves. If you create a pool of 100 items, and then call get() followed by put(), you will have put one item on the inuse stack which also appears on the reuse stack. If you do this again, you will put the same item on the inuse stack a second time (a duplicate). Repeat 100 times and the inuse stack will become full and you won't be able to allocate any more items, even though there are actually all 100 items left to allocate.

The inuse stack should be replaced by a simple counter of how many items are in use. You can increment the counter on each get and decrement it on each put.

###Inuse stack purpose?###

I'm not sure what purpose your inuse stack serves. If you create a pool of 100 items, and then call get() followed by put(), you will have put one item on the inuse stack which also appears on the reuse stack. If you do this again, you will put the same item on the inuse stack a second time (a duplicate). Repeat 100 times and the inuse stack will become full and you won't be able to allocate any more items, even though there are actually all 100 items left to allocate.

The inuse stack should be replaced by a simple counter of how many items are in use. You can increment the counter on each get and decrement it on each put.

Inuse stack purpose?

I'm not sure what purpose your inuse stack serves. If you create a pool of 100 items, and then call get() followed by put(), you will have put one item on the inuse stack which also appears on the reuse stack. If you do this again, you will put the same item on the inuse stack a second time (a duplicate). Repeat 100 times and the inuse stack will become full and you won't be able to allocate any more items, even though there are actually all 100 items left to allocate.

The inuse stack should be replaced by a simple counter of how many items are in use. You can increment the counter on each get and decrement it on each put.

Source Link
JS1
  • 28.9k
  • 3
  • 41
  • 83

###Inuse stack purpose?###

I'm not sure what purpose your inuse stack serves. If you create a pool of 100 items, and then call get() followed by put(), you will have put one item on the inuse stack which also appears on the reuse stack. If you do this again, you will put the same item on the inuse stack a second time (a duplicate). Repeat 100 times and the inuse stack will become full and you won't be able to allocate any more items, even though there are actually all 100 items left to allocate.

The inuse stack should be replaced by a simple counter of how many items are in use. You can increment the counter on each get and decrement it on each put.

lang-c

AltStyle によって変換されたページ (->オリジナル) /