Memory Usage for Java implementation

94 views
Skip to first unread message

dda...@gmail.com

unread,
Feb 4, 2013, 3:40:49 AM2/4/13
to diff-mat...@googlegroups.com
Hi Neil,

I am using your DMP - Java code for a multi-threaded application which stores versions of files (essentially patches). The problem I am facing is with memory usage.  Going through the code I see a lot of "new String()" and "String.substring()" usage which ends up being immutable and hence increases memory dramatically as the file size gets larger.

For instance if I have a file 10 MB, and am creating patches with 10 other files, the memory shoots up to 1.5 GB for one thread alone. If "StringBuilder" is used, it will limit the usage to 200 MB or so.

Is there a way to change the "String" usage to either "StringBuffer" or "StringBuilder" (preferably the latter) to make it more memory efficient and maybe use "static ThreadLocal" variables.? Any help is appreciated.

Thanks,
AR.
Reply all
Reply to author
Forward
0 new messages