Velocity foreach - memory leak

D

Darek

I hava a collection of objects (less than 1000) and I want to list it
in html form, so I try to use foreach directive, but I got outofmemory
error.

I read about that problem, but i didn't find any solutions.
That's a problem for me because I have about 256MB or 512MB and I
cannot parse all 340 rows now, every row takes approximately about
0,5Mb, I cannot accept that, because for 3000 rows in collection i
should have 1,5GB of memory.
That's too much for a small system. I don't event want to think about
system with 100 000 rows (some people had to go through it, I
suppose).

I'm thinking about limiting results with offset, but i'd like to avoid
it, because total number of rows should'nt exceed 10 000 rows, and
customer don't want it, except entering search criterion.
Any help would be appreciated, maybe that form should be rewritten in
other technology i.e JSP, but I'm almost sure, that I found something
about that problem also in JSP.

Darek
 
D

David Robbins

Darek said:
I hava a collection of objects (less than 1000) and I want to list it
in html form, so I try to use foreach directive, but I got outofmemory
error.

I read about that problem, but i didn't find any solutions.
That's a problem for me because I have about 256MB or 512MB and I
cannot parse all 340 rows now, every row takes approximately about
0,5Mb, I cannot accept that, because for 3000 rows in collection i
should have 1,5GB of memory.
That's too much for a small system. I don't event want to think about
system with 100 000 rows (some people had to go through it, I
suppose).

I'm thinking about limiting results with offset, but i'd like to avoid
it, because total number of rows should'nt exceed 10 000 rows, and
customer don't want it, except entering search criterion.
Any help would be appreciated, maybe that form should be rewritten in
other technology i.e JSP, but I'm almost sure, that I found something
about that problem also in JSP.

Darek

it sounds like you need to redesign the solution so that you don't have to
keep everything in memory at once. go back to some of the methods used when
memory was expensive, only parse one object at a time as needed, keep the
others somewhere else, use temporary disk files, only parse out relevant
details and ignore other parts... things like that. maybe a good database
server would be able to handle lots of the work for you instead of doing it
in an application.
 
D

Darek

David Robbins said:
it sounds like you need to redesign the solution so that you don't have to
keep everything in memory at once. go back to some of the methods used when
memory was expensive, only parse one object at a time as needed, keep the
others somewhere else, use temporary disk files, only parse out relevant
details and ignore other parts... things like that. maybe a good database
server would be able to handle lots of the work for you instead of doing it
in an application.


I use database for storing data. It is weird, that collection of
objects takes to 20MB, but parsing it in velocity foreach, takes
hundreads

Darek
 
D

David Robbins

Darek said:
"David Robbins" <[email protected]> wrote in message


I use database for storing data. It is weird, that collection of
objects takes to 20MB, but parsing it in velocity foreach, takes
hundreads

Darek

you may have gone beyond what they intended that for, in any case it sounds
like time for a redesign... or maybe find a different tool that is more
efficient.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top