Out of Memory error?
3 posters
Page 1 of 1
Out of Memory error?
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
What does that mean?
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
What does that mean?
sadia- Admin
- Posts : 75
Join date : 2010-10-10
Re: Out of Memory error?
means something is writing too much into the computers memory or smth
i ran into it when i was writing the multiplier and had a slight typo where i basically concatonated the string to itself like
str += str.concat(str);
in a loop so the strings got REALLY long and eventually java ran out of memory.
dunno wats happening in your situation but theres probably somethin similar goin on
i ran into it when i was writing the multiplier and had a slight typo where i basically concatonated the string to itself like
str += str.concat(str);
in a loop so the strings got REALLY long and eventually java ran out of memory.
dunno wats happening in your situation but theres probably somethin similar goin on
Lenny- Admin
- Posts : 65
Join date : 2010-10-08
Re: Out of Memory error?
lol, that's what happens when you throw so many errors, and each error thrown creates a heapdump file, which contains the current state of the program at each error.
it accumulates in your computer, and when it gets too much, and you don't have enough space for more heapdumps, an OOM (out of memory) error gets thrown.
it's not good lol which is why i didn't want to use throwables as a way to catch malformed urls etc.
it accumulates in your computer, and when it gets too much, and you don't have enough space for more heapdumps, an OOM (out of memory) error gets thrown.
it's not good lol which is why i didn't want to use throwables as a way to catch malformed urls etc.
daniel- Admin
- Posts : 87
Join date : 2010-10-08
Re: Out of Memory error?
rrr i was hopin the computer wouldnt have a limit on that exception thing. ok so wat do we do now? i guess we'll have to redo a lil bit of the design
Lenny- Admin
- Posts : 65
Join date : 2010-10-08
Re: Out of Memory error?
so do we want to implement this fix?
daniel wrote:I was talking to Sadia on our way to Sheridan about the case in which we validate the input URL, instead of parsing through all of the URLs.
nested try catch is legal, HOWEVER, it's not recommended in term of style, especially when it is part of the functionality of the program.
The reason for this is the following. Whenever/everytime an error is caught, the program creates a dump file (a file containing the entire state of the program) for debugging purposes. Normally, this wouldn't affect us, since our dump file is less than a few KB big. however when we program bigger programs, like photoshop big, it can get up to 500MB. This accumulates in the computer, and the user will not be happy lol. Furthermore, it prints a stack trace to the console, which overshadows all of the console output we may output.
The way we can validate invalid URLs (by invalid we mean malformed, no connection etc), is to do the following:
In the FMLinkFinder, I noticed that the constructor does the following:
- Code:
Document mainPage = Jsoup.connect(currURL).get();
link = mainpage.select("a[href]");
what we can do is this:
1. Create a global private Connection conn; in FMLinkFinder.
2. modify the constructor to the following:
- Code:
conn = Jsoup.connect(currURL);
if (conn != null) { // We need to find out if indeed, Jsoup.connect(URL) returns null IF no connection can be made
Document mainPage = conn.get();
link = mainpage.select("a[href]");
}
Create a GET method for the connection object:
- Code:
public Connection getConnection() {
return conn;
}
in the UI:
instead of the try catch block, try this:
- Code:
if (fm.getConnection() == null) {
statusText.setText("[error message]");
} else {
//do whatever is currently coded
We can apply this exact concept to all of the errors Lenard wrote, in order to prevent error.
=)
daniel- Admin
- Posts : 87
Join date : 2010-10-08
Re: Out of Memory error?
ok how do we do it with minimal information handling at the front end?
ohhh btw ive done some test on otehr stuff before regarding invalid links and found out that when
Document mainPage = Jsoup.connect(currURL).get();
connects to a broken link, it doesnt equal null. i think it threw an error or something
ohhh btw ive done some test on otehr stuff before regarding invalid links and found out that when
Document mainPage = Jsoup.connect(currURL).get();
connects to a broken link, it doesnt equal null. i think it threw an error or something
Lenny- Admin
- Posts : 65
Join date : 2010-10-08
Re: Out of Memory error?
Jsoup.connect(currURL).get() doesn't return null, but what about Jsoup.connect(currURL)?
if you get something from a null, then it's an error, but what does connect(URL) return if URL is invalid?
if you get something from a null, then it's an error, but what does connect(URL) return if URL is invalid?
daniel- Admin
- Posts : 87
Join date : 2010-10-08
Re: Out of Memory error?
tested it on a seperate java application and Jsoup.connect("http://www.somenonexistingurl.tk/why/do/noses/run/and/feet/smell.htmooplah") returns an ioexception
Lenny- Admin
- Posts : 65
Join date : 2010-10-08
Re: Out of Memory error?
ah i see........
in that case, there's really not much we can do... if we had more time, we could use a different library, that returns null if no connection can be made... this jsoup library assumes that the url is always correct, and there's always internet connection... which is kinda fail design...
i guess we'll just have to explain it to the prof
in that case, there's really not much we can do... if we had more time, we could use a different library, that returns null if no connection can be made... this jsoup library assumes that the url is always correct, and there's always internet connection... which is kinda fail design...
i guess we'll just have to explain it to the prof
daniel- Admin
- Posts : 87
Join date : 2010-10-08
Re: Out of Memory error?
it should be okay..
i don't think we're running into the outofmemory error anymore. for now. so.
i think it should be fine to leave it as it is.
i don't think we're running into the outofmemory error anymore. for now. so.
i think it should be fine to leave it as it is.
sadia- Admin
- Posts : 75
Join date : 2010-10-10
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum