Advertisement Jump to content
  • Advertisement

Kevinator

Member
  • Content Count

    1018
  • Joined

  • Last visited

Community Reputation

229 Neutral

About Kevinator

  • Rank
    Contributor

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, my problem is that I'm running out of heap space when I'm only about 20% complete with my problem, so increasing the space allocated to the JVM isn't exactly a valid solution. Here's what I'm basically doing: String aHugeString=""; Foo[] foo=new Foo[12000]; for(int i=0; i<12000; i++) { aHugeString=getHugeString(); //string is roughly 32kb foo=new Foo(aHugeString.substring(1323,1335)); //each element of foo contains roughly 30 bytes } It can't be the array, can it? It seems to me that there should be plenty of heap space for the array. What I'm thinking is that the string isn't getting garbage collected or something.. I don't know why it wouldn't, though.. So please, if there is something obviously stupid I'm doing please set me straight. This really shouldn't be happening.. Progress update: I tested out a mockup array without all the other string processing and it does just fine. I'm currently testing a version with periodic manual garbage collection and we'll see how it goes. update 2: the manual gc doesn't make a difference.. I'm stuck. update 3: I've been scouring the internets for a solution, and came across THIS. Quote:As such, substring() calls are incredibly fast: you're just allocating a new object and copying a pointer and two int values into it. On the other hand, it means that if you use substring() to extract a small chunk from a large string and then throw the large string away, the full data of that large string will continue to hang around in memory until all its substrings have been garbage-collected. Which could mean you carrying around the complete works of Shakespeare in memory, even though all you wanted to hang on to was "What a piece of work is man!" O_o Wow. That... that sucks. Trying to find a workaround, as I think this is what is plaguing my app. [Edited by - Kevinator on August 14, 2008 12:07:35 AM]
  2. Thanks, this confirms my suspicion that there is something wrong with my compile process rather than my code.
  3. "This method must return a result of type int Possible problem: the if-statement structure may theoretically allow a run to reach the end of the method without calling return. Consider using a final else {... to ensure that return is always called." My question is... why? My code must return an int as far as I can tell. private int getNumber(String str, int index) { String estr=""+str.charAt(index); if(!Character.isDigit(str.charAt(index))) return -1; else { index++; while(index<str.length()&&Character.isDigit(str.charAt(index))) { estr+=str.charAt(index); index++; } return Integer.parseInt(estr); } } The following variation results in the same problem: private int getNumber(String str, int index) { String estr=""+str.charAt(index); if(!Character.isDigit(str.charAt(index))) return -1; else { index++; while(index&lt;str.length()&&Character.isDigit(str.charAt(index))) { estr+=str.charAt(index); index++; } return -50; } return -100; }
  4. Kevinator

    Cultural misunderstandings and business

    Quote:Original post by Mithrandir I can't stand pretentiousness. If someone doesn't want to do business with me because I offended some silly archaic custom unintentionally, then that's their loss. There are plenty of other people to do business with in this world. Exactly, and furthermore, FUCK them.
  5. Kevinator

    Quake 4

    Quake 4 was a good game, and I got quite far in it, but my computer just isn't quite beefy enough to play it well, so I got frustrated with the poor framerate and I haven't played it since. I did like the actual game, though.
  6. Kevinator

    space combat games

    Freespace (1) is my favorite space combat game of all-time, closely followed by TIE Fighter and Freelancer.
  7. Kevinator

    Critique this ad design

    Quote:Original post by Mithrandir He wants to eliminate the department of education and let states regulate education all by themselves.This is the number one reason I'll vote for him. Not to derail, sorry. I really like the poster. Good work on it.
  8. Kevinator

    alternatives to 'said'

    -pontificate (pontificated)
  9. Kevinator

    Java Applets

    Quote:Original post by Help_Me I can't find any information on google and yahoo.Amuses me, this quote does.
  10. Kevinator

    5 top 2D games of all time?

    From a technical/artistic standpoint, it would be a downright shame not to have Diablo II on that list somewhere.
  11. Kevinator

    Hmmm. Do graphics really make or break the game......

    Heh... I was just about to say real duck hunting isn't exactly anything to write home about either. It can be hours before you even get an opportunity to take a shot, freezing your ass off all the while and sitting in water up to your ankles.
  12. Kevinator

    Random enemies

    An enemy is a good candidate for a class. The simplest way to do it is to instantiate a random enemy object inside your addEnemy() method. Then, add the enemies to a vector so you can keep track of them. The vector needs to be accessible to all the methods that update enemy locations and render them, obviously, so it might be a good candidate for a global or member variable.
  13. Kevinator

    Shooting Bullet in JAVA

    I like your code. Is direction some kind of angle modifier so that the shots emanate from the player in a fan shape? That's pretty nifty. As Endurion said, the reason for the error is that when you try to return shot, the compiler can't find that variable because that variable no longer exists when you exit the for loop. Try this: public Shot[] Shoot5Bullet() { Shot[] shots = new Shot[5]; for(int direction = 0; direction < 5; direction++) shots[direction] = new Shot(start_x, start_y, direction); return shots; }
  14. Kevinator

    How to create sprite sequence

    Somewhat related question: is it better to store all the frames in a single file or is it okay to use them as separate files (think walk_1.gif, walk_2.gif, etc). Is there a huge performance drain for doing this?
  15. Kevinator

    Consolas: The Next Programmer Font

    I love clear type and consolas. I've been using both for several months!
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!