Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] RAM Usage Optimization

Hello everyone,

One of the current problem we are concerned with is that the projects complexity increases and the RAM needed for the indexer is scaling with them.
To get an idea, for a project with ~5k files, the RAM usage grows up to 4gb of RAM (with a -Xmx limitation, otherwise, perhaps it could go higher).

I assume the cause is the incapability of the GC to free the memory as fast as new objects are allocated (a manual GC clears the RAM used, but a few seconds later it is filled again).

Considering the above, would you allow refactorings like the following?

Refactor:
for (int i =0; ; i++) {
    char[] charrArray = new char[1000];
}

As:
char[] charrArray;
for (int i =0; ; i++) {
    charrArray = new char[1000];
}

If yes, I'm willing to do the refactorings myself and benchmark the changes.
If no, why? (other than the reason that the variables should be declared in the minimum scope).

Regards,
Adrian Costean

Back to the top