0

I am doing a lot of processing and searching on list of objects. My application goes out of memory while rendering the results. Is there any API for handling/Processing list of objects efficiently, I am trying to optimize it.

One more thing I want to tell, I am initializing all my list with new ArrayList. Should I use something else?

I have a screen that need to show records and to search these records, I am using there API (the only way I have as I have no access to their DB and I cannot run SQL Queries.) each record that is displayed on the screen is searched for specific criteria and I am using their searching APIs for the same. I am debugging the code and found that exception is thrown by that searching method. I am pasting the error log

Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: [OWLS][SQLServer JDBC Driver][SQLServer]There is insufficient system memory in resource pool 'internal' to run this query.
Error Code: 701
Call: SELECT DISTINCT t0.PRIMARY_KEY, t0.TOTAL_ACCRUAL, t0.TOTAL_ALLOCATED, t0.ALLOC_LIMIT, t0.APPL_END_ON, t0.APPL_EXPENSE_PERCENT, t0.APPL_NON_US_TAX_PERCENT, t0.APPL_INVD_EXPENSE_PERCENT, t0.APPL_INVD_TASK_PERCENT, t0.APPL_START_ON, t0.APPL_TASK_PERCENT, t0.INVOLVED_APPL_TYPE_IID, t0.PROJECT_APPL_TYPE_IID, t0.VENDOR_APPL_TYPE_IID, t0.TOTAL_BG_AVAILABLE, t0.CREATED_ON, t0.STATUS_IID, t0.APPL_EXPENSE, t0.APPL_INVC_ACCRUAL, t0.APPL_INVC_CREDIT_NOTE, t0.APPL_NON_US_TAX, t0.APPL_INVC_SHADOW, t0.APPL_INVC_STANDARD, t0.APPL_INVD_EXPENSE, t0.APPL_INVD_TASK, t0.APPL_TASK, t0.AUTO_POST, t0.MODIFIED_ON, t0.NAME, t0.OVERDRAFT_TYPE_IID, t0.POSTED_TYPE_IID, t0.SECURITY_TYPE_IID, t0.TREE_KEY, t0.TYPE_IID, t0.TOTAL_USED, t0.VERSION, t0.APPL_EXPENSE_CATEGORY_ID, t0.APPL_NON_US_TAX_TYPE, t0.APPL_INVOLVED_ID, t0.APPL_INVD_EXP_CATEGORY_ID, t0.APPL_INVD_TASK_CATEGORY_ID, t0.APPL_PROJECT_CATEGORY_ID, t0.APPL_PROJ_DETAIL_FIELD_ID, t0.PROJECT_ID, t0.APPL_TASK_CATEGORY_ID, t0.APPL_VENDOR_ID, t0.APPROVAL_STATUS_ID, t0.CREATED_BY_ID, t0.CREATED_ON_BEHALF_OF_ID, t0.DEFAULT_CATEGORY_ID, t0.DOCUMENT_FOLDER_ID, t0.FORUM_ID, t0.MODIFIED_BY_ID, t0.NOTE_ID, t0.PARENT_ACCOUNT_ID FROM T_ACCOUNT_SECURITY_FILTER t5, Y_OBJ_CATEGORY t4, T_PROJECT t3, E_ACCT t2, T_CONTACT t1, T_ACCOUNT t0 WHERE ((((((((((t0.VENDOR_APPL_TYPE_IID = 2) AND (t1.PRIMARY_KEY = 2004)) AND (t2."YEARACCT" = N'2012')) AND (t0.PROJECT_APPL_TYPE_IID = 2)) AND (t3.PRIMARY_KEY = 46537)) AND (t4.TREE_POSITION = N'ACCT_ACTL_CCSP_VNDR_MONT')) AND (t0.NAME = N'Actuals - Cost Center 10 - LA2012000250 - Singla, Ashima - 2012 - October')) AND (t2."PERIODACCT" = N'M9')) AND (t5.USER_ID = 1504)) AND (((((t1.PRIMARY_KEY = t0.APPL_VENDOR_ID) AND (t2.ACCOUNT_ID$ = t0.PRIMARY_KEY)) AND (t3.PRIMARY_KEY = t0.PROJECT_ID)) AND (t4.PRIMARY_KEY = t0.DEFAULT_CATEGORY_ID)) AND (t5.ENTERPRISE_OBJECT_ID = t0.PRIMARY_KEY)))
Query: ReadAllQuery(referenceClass=TFAccount sql="SELECT DISTINCT t0.PRIMARY_KEY, t0.TOTAL_ACCRUAL, t0.TOTAL_ALLOCATED, t0.ALLOC_LIMIT, t0.APPL_END_ON, t0.APPL_EXPENSE_PERCENT, t0.APPL_NON_US_TAX_PERCENT, t0.APPL_INVD_EXPENSE_PERCENT, t0.APPL_INVD_TASK_PERCENT, t0.APPL_START_ON, t0.APPL_TASK_PERCENT, t0.INVOLVED_APPL_TYPE_IID, t0.PROJECT_APPL_TYPE_IID, t0.VENDOR_APPL_TYPE_IID, t0.TOTAL_BG_AVAILABLE, t0.CREATED_ON, t0.STATUS_IID, t0.APPL_EXPENSE, t0.APPL_INVC_ACCRUAL, t0.APPL_INVC_CREDIT_NOTE, t0.APPL_NON_US_TAX, t0.APPL_INVC_SHADOW, t0.APPL_INVC_STANDARD, t0.APPL_INVD_EXPENSE, t0.APPL_INVD_TASK, t0.APPL_TASK, t0.AUTO_POST, t0.MODIFIED_ON, t0.NAME, t0.OVERDRAFT_TYPE_IID, t0.POSTED_TYPE_IID, t0.SECURITY_TYPE_IID, t0.TREE_KEY, t0.TYPE_IID, t0.TOTAL_USED, t0.VERSION, t0.APPL_EXPENSE_CATEGORY_ID, t0.APPL_NON_US_TAX_TYPE, t0.APPL_INVOLVED_ID, t0.APPL_INVD_EXP_CATEGORY_ID, t0.APPL_INVD_TASK_CATEGORY_ID, t0.APPL_PROJECT_CATEGORY_ID, t0.APPL_PROJ_DETAIL_FIELD_ID, t0.PROJECT_ID, t0.APPL_TASK_CATEGORY_ID, t0.APPL_VENDOR_ID, t0.APPROVAL_STATUS_ID, t0.CREATED_BY_ID, t0.CREATED_ON_BEHALF_OF_ID, t0.DEFAULT_CATEGORY_ID, t0.DOCUMENT_FOLDER_ID, t0.FORUM_ID, t0.MODIFIED_BY_ID, t0.NOTE_ID, t0.PARENT_ACCOUNT_ID FROM T_ACCOUNT_SECURITY_FILTER t5, Y_OBJ_CATEGORY t4, T_PROJECT t3, E_ACCT t2, T_CONTACT t1, T_ACCOUNT t0 WHERE ((((((((((t0.VENDOR_APPL_TYPE_IID = ?) AND (t1.PRIMARY_KEY = ?)) AND (t2."YEARACCT" = ?)) AND (t0.PROJECT_APPL_TYPE_IID = ?)) AND (t3.PRIMARY_KEY = ?)) AND (t4.TREE_POSITION = ?)) AND (t0.NAME = ?)) AND (t2."PERIODACCT" = ?)) AND (t5.USER_ID = ?)) AND (((((t1.PRIMARY_KEY = t0.APPL_VENDOR_ID) AND (t2.ACCOUNT_ID$ = t0.PRIMARY_KEY)) AND (t3.PRIMARY_KEY = t0.PROJECT_ID)) AND (t4.PRIMARY_KEY = t0.DEFAULT_CATEGORY_ID)) AND (t5.ENTERPRISE_OBJECT_ID = t0.PRIMARY_KEY)))")
    at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:687)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:530)
    at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:529)

Thanks Ravi Kumar

3
  • 3
    Can you post your code. That will help in understanding your issue. Commented May 2, 2012 at 6:30
  • The code is using specific API exclusively build for that application and it will be difficult for you guys to understand. As it is not just simple collection, list. Commented May 2, 2012 at 7:17
  • Problem is solved. This is due to insufficient space at DB. Thank you all guys Best Regards Ravi Kumar Commented May 2, 2012 at 8:22

2 Answers 2

2

You could take a look at Apache's CollectionUils package. The API could provide some functionality which you might already be doing but the API might do it more efficiently. That being said, without telling us what you are actually doing we can only speculate.

Sign up to request clarification or add additional context in comments.

5 Comments

yeah, you are right. I am working under Non Disclosure Agreement (NDA). I cannot post anything. I am sorry about that.
@Ravi.Kumar: then you should provide an example outlining the idea of what you try to accomplish.
ok. I have a screen that need to show records and to search these records, I am using there API (the only way I have as I have no access to their DB and I cannot run SQL Queries.) each record that is displayed on the screen is searched for specific criteria and I am using their searching APIs for the same. I am debugging the code and found that exception is thrown by that searching method. I am pasting the error log on my question.
@Ravi.Kumar: If you are getting an exception from their API then you should be contacting whoever is responsible for maintaining it. If you want to implement your own searching then you should at least provide a simply structure which mimics (although might not necessarily need to replicate) what you are working with.
Problem is solved. This is due to insufficient space at DB. Thank you all guys Best Regards Ravi Kumar
0

Have you considered some lazy loading technique?

For example loading your collection objects during the actual iteration over the collection.

Or Having a lightweight representation (for example only object's DB key) of the actual objects stored in the collection.

If you want efficient search then you should consider search engine libraries such as Lucene.

1 Comment

Problem is solved. This is due to insufficient space at DB. Thank you all guys Best Regards Ravi Kumar

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.