Steve
Steve
Alex Hurtt wrote:I would try and take a multi threaded approach to this problem if possible. Maybe you could make a thread pool of size 10 or so and hand off 100 element chunks of the list to worker threads to process. I just pick 10 as some arbitrary number...I have no idea what this list actually contains or what you are trying to do with the data. You would have to find the right balance of chunk size and number of threads to yield you the best performance.
Steve Luke wrote:I don't think the use of Threads has any bearing on the memory footprint the original poster has described. It is probably a little off track to suggest that as a solution. It may make the processing faster, but it may even make the memory footprint larger (since multiple sublists may be processed at once, instead of allowing the memory from one sublist to be 'cleared' before the next one is access). But like has been said - without more knowledge there is not a whole lot we can suggest that isn't guess work.
...and create that many n sized lists. I'm not really sure I see what that buys either. Also I'm not sure why you'd need to create a new 'sub' list reference after each iteration...can't you just reassign the existing reference to a new 'sub' list object?
Steve
Steve Luke wrote:I agree Alex... I don't mean to look like I was criticizing. My only point was there wasn't enough information about what the scenario is to make real suggestion.
...and create that many n sized lists. I'm not really sure I see what that buys either. Also I'm not sure why you'd need to create a new 'sub' list reference after each iteration...can't you just reassign the existing reference to a new 'sub' list object?
True, you don't need to make more than one variable / references. Re-using the same one is just as good, and will be easier to manage...
ben oliver wrote:I doubt that, if I use the sublist approach (without loading the entire big list i the memory first_, it would really help. JVM has no guarantee it will garbage clooect the sublist even it is no longer referenced because you don't know when the garbage collection cycle occurs. So, maybe when the code proceeds with the other sublists, the existing sublists have not been collected when it reaches the final sublist..
Isn't this possible ?
Be reasonable. You can't destroy everything. Where would you sit? How would you read a tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|