aspose file tools*
The moose likes Performance and the fly likes memory limit crossed (assignment) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "memory limit crossed (assignment)" Watch "memory limit crossed (assignment)" New topic
Author

memory limit crossed (assignment)

Muhammad Salman
Greenhorn

Joined: Apr 11, 2012
Posts: 7
hi,

I have an assignment in which I have to create a program which decodea message. As an input I am given a file with keys and messages. The file format is

no of key/message pairs
key
message
..
..

The message I have is always lowercase string seperated by spaces, for example : hello world. The key I am provided it always integer, for example : 1595.
Now, what I have to do here is that I have to decode and the logic for that is that I have to shift the letters in the message by the given number and I have to move from left to right and then right to left for the number. For example : considering the above key and the message

h+1=i, e+5=j, l+9=u, l+5=q

Now that we used all the digits, we do it again from right to left:

o+5=t, the space is discarded, w+9=f, o+5=t, r+1=s

we repeat the process, starting from left to right:

l+1=m, d+5=i

The result is: ijuqt ftsmi.


So, i achieve this result but my program fails because it exceeds the memory limit. Below is my program if someone can help me I would be grateful
Claude Moore
Ranch Hand

Joined: Jun 24, 2005
Posts: 281
    
    1

What do you mean with "program terminates because exceedes memory limit" ? Do you have a Stack Overflow error or and Heap Memory error ? (I don't remember exact names of these exceptions, sorry)

Apparently I cannot see in your code possibile endless loops or endless recursion calls to get such errors, at least if number of tests is enough small...
Luan Cestari
Ranch Hand

Joined: Feb 07, 2010
Posts: 129

Which exception do you get running this program?

I posted some information that might help you:
http://www.ourdailycodes.com/2013/08/inside-java-jvm-memory-structure.html
http://www.ourdailycodes.com/2013/09/inside-java-jvm-memory-structure-2.html
http://www.ourdailycodes.com/2013/09/inside-java-jvm-memory-structure-3.html


Please, visit me for some cool tech post at www.ourdailycodes.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: memory limit crossed (assignment)
 
Similar Threads
Need Suggestions on Solution for Store Credit - GCJ 2010 (Africa)
how to read paritcular line in java and store that particular line line
Array out of bound; arrays handling
sting tokenizer in a loop(vv urgent)
doubt in some programs and question in java