ntcore icon indicating copy to clipboard operation
ntcore copied to clipboard

Potential issues when deleting entries

Open virtuald opened this issue 8 years ago • 1 comments

I'm not really expecting this to be fixed, but putting it here so it can be thought about.

If an uninformed user sets/deletes the same key over and over again, in Storage m_idmap will eventually become very large because ids are never reused. Additionally, if m_idmap gets over 65535 entries, then I think all sorts of bad things happen.

I wonder if there's any harm in reusing an ID after a key gets deleted? Right now the id is used to track whether something is assigned, but another variable could be used for that.

Specifically excluded is the case of a user creating lots of random keys and deleting them -- while it would definitely create problems, this usage seems fairly unreasonable.

virtuald avatar Oct 02 '17 12:10 virtuald

I think reusing the server IDs (m_idmap IDs) is okay, as long as they aren't instantly reused (e.g. we should do the UidVector thing with a freelist that doesn't start getting reused until some number are released, and then reusing in a FIFO manner).

Agreed that creating/deleting random keys should just be documented as a "don't do that".

PeterJohnson avatar Oct 02 '17 20:10 PeterJohnson