java.lang.OutOfMemoryError: Java heap space

Hi there,

I have an email receiving script which receives emails, creates a record for each email also creates history records for each attachments and save the physical attachments to a web server using http plugin (in conjunction with php - http post method)

I have around 400 mails in my mailbox. The mails are received through the servoy client. I am using windows xp with 1G ram. I was watching the Task Manager for the memory consumption. The Task Manager showed that the java process took around 130MB when I got this error message. I wonder why I get this error when I still have a lot of memory left. May be there are some settings which need to be set.

I have successfully received all the emails through the Servoy Developer. I guess it is because of the following settings I use to start the developer.

%windir%\system32\javaw.exe -Xmx512m -Xms256m -XX:PermSize=128m -Dproperty-file=servoy_developer.properties -jar servoy_developer.jar

But I still do not understand the concept of heap space and OutOfMemory errors.

Also the error did not crash the whole servoy client. I can continue working with records after the error.

Please help.

Thanks a lot.

plugins.mail.receiveMail(record.pop_user_name, record.pop_password, 
                                       leaveMessageOnServer, receiveMode, onlyreceiveMsgWithSentDate,
                                       propertiesArr);

The above line produces out of memory error…

Where do you see this error? In the client?

Servoy’s mail plugin receives messages on the server. Maybe the problem is there?

The issue is on the client not on the server.

Dear Servoyians,

At least please let me know how to increase the heap space size in the servoy client.

Thanks a lot!

You can do that in the server admin (web page). There is a maxClientHeap property.

Still crashed and I just could not increase the heap size to a very high level. For most of the client computers it does not make any sense utilizing the whole computers memory.

So I used php to get around this problem. Now I use PEAR’s Net_POP3 class to receive the emails. It is fast and no memory issues.

Cheers

To use the changed maxClientHeap setting you do need to re-download the client. Or you can edit the downloaded .jnlp file yourself since this is just an XML file.
Do make sure your webstart cache is empty.

So other users that already have downloaded the client with the old settings are still using that old setting.

Hope this helps.

Thanks for the tip. I can try that.
But what mail plugin does is, it retrieves all the messages at one time.

I think the plugin has to be modified so that it receives just the message list (not the actual message but just a unique id for each mails as an array). The n we can loop through that array and retrieve the actual message one at a time.

With this approach we can solve two issues:
1> the out of memory issue
2> we can show the user a better progression of what’s happening.

Currently the screen just goes complete frozen for around 15 mins when the plugin receives the emails

As an alternative, you could consider trying the MailPro-Plugin, which allows you to do all that :) .

Thanks for the info.

I will surely consider using this for one of our next project that needs this plugin. Now my PHP solution is working perfectly.

Thanks

Also consider that the Servoy mail plugin actually comes with the source. So if you feel up to it you can change it yourself.

Hope this helps.