Raised This Month: $ Target: $400
 0% 

Out of keyvalue string space


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iaNanaNana
Member
Join Date: Sep 2020
Location: Two-dimensional
Old 09-06-2023 , 02:20   Out of keyvalue string space
Reply With Quote #1

when I create a KeyValues and import from file over 110000 times, it crashed the server and gave "Out of keyvalue string space", is this about KeyValues can't release the memories after I use the CloseHandle() or delete?

Here's the example codes:
PHP Code:
Loop(count)
{
    
char s[200]
    
FileType c
    KeyValues k 
= new KeyValues(" ")
    while(
ReadDirEntry(hDirssizeof(s), c)) // Have over 110000 files in this directory
    
{
        if(
!= FileType_File) continue
        
k.Rewind()
        
k.ImportFromFile(s);
        
count++
        if(
count%100 == 0)
        {
            
k.Close()
            
PrintToServer("%i..."count)
            
RequestFrame(Loopcount)
            return
        }
    }
    
k.Close()
    
CloseHandle(hDir)
    
PrintToConsole(0"Total %i."count)


Last edited by iaNanaNana; 09-06-2023 at 09:27.
iaNanaNana is offline
Forgetest
Member
Join Date: Aug 2020
Old 09-21-2023 , 16:03   Re: Out of keyvalue string space
Reply With Quote #2

Where the error's exactly from: https://github.com/UXR7b/csgo2018lea...ystem.cpp#L319 (and more lines at below)
So according to it you're probably running out of a fixed space to map key strings to key symbols (haven't looked into the system, pure guess).

However, there's an internal function KeyValues::SetUseGrowableStringTable(bool), easy to tell that it can turn to a growable vector for the mapping.
Should be handy for you to access it through SM in server lib, but the effects remain unknown.

But my question is how would you run into messing with such a number of files?

Edit: Looks like if you'd like to use the growable table under its limitations, you have to find a way to call the function before all I/O to KeyValueSystem (perhaps via valve plugins).

Last edited by Forgetest; 09-21-2023 at 16:16.
Forgetest is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode