Skip to main content

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

Hi Adrian,

> 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.

I have noticed this as well.

> 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).

I haven't investigated the matter enough to comment on the cause. I 
would hesitate to draw conclusions based on assumptions.

> 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.

I would be surprised if a refactoring like the above made a difference. It
seems to me that the JVM should already treat the above two snippets 
equivalently.

That said, if benchmarks show that a change like the above really does
make a difference, I don't see why we wouldn't accept it, assuming it
preserves functionality, and preserves readability to the extent the above
example does.

Regards,
Nate

Back to the top