Thread: [PI] Soulsplit memory leak

Results 1 to 5 of 5
  1. #1 [PI] Soulsplit memory leak 
    Registered Member

    Join Date
    Sep 2008
    Posts
    4,833
    Thanks given
    894
    Thanks received
    1,439
    Rep Power
    2924
    Code:
    final int pX = c.getX();
     					final int pY = c.getY();
    					final int nX = Server.npcHandler.npcs[c.oldNpcIndex].getX();
    					final int nY = Server.npcHandler.npcs[c.oldNpcIndex].getY();
    					final int offX = (pY - nY)* -1;
    					final int offY = (pX - nX)* -1;
    					c.SSPLIT = true;
    					c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, 50, 2263, 9, 9, c.oldNpcIndex + 1, 24, 0);
    					EventManager.getSingleton().addEvent(new Event() {
    					public void execute(EventContainer b) {
     					Server.npcHandler.npcs[c.oldNpcIndex].gfx0(2264); // 1738
    					c.SSPLIT = false;
    				        b.stop();
    					}
    					}, 500);
    					EventManager.getSingleton().addEvent(new Event() { // CAUSES CRASH
    					public void execute(EventContainer b) {
    					c.getPA().createPlayersProjectile2(nX, nY, offX, offY, 50, 50, 2263, 9, 9, - c.playerId - 1, 24, 0);
    				        b.stop();
    					}
    					}, 800);
    					} catch (Exception e) {
    					e.printStackTrace();
    im Getting a nullpointer exception from...

    Code:
    Server.npcHandler.npcs[c.oldNpcIndex].gfx0(2264);
    I know that this soulsplit method is flawed and horrible way to do it with events and such, Wondering if anyone would be willing to share a better way which isnt riddled with memory leaks?
    "Know thy self, know thy enemy. A thousand battles, a thousand victories." - Sun Tzu
    GitHub: https://github.com/Faris-Mckay
    Reply With Quote  
     

  2. #2  
    Banned
    Join Date
    Oct 2011
    Posts
    860
    Thanks given
    371
    Thanks received
    214
    Rep Power
    0
    Delete the line. I did and no more memleak. It occurs when the gfx is trying to hit something and then it moves.

    Also happens for DFS
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Oct 2009
    Posts
    1,312
    Thanks given
    148
    Thanks received
    161
    Rep Power
    33
    Why the fuck are you calling this a 'memory leak' lmfao.


    --> Within the event that you are executing just add a simple check if the player isn't a null.

    Code:
    					EventManager.getSingleton().addEvent(new Event() {
    						public void execute(EventContainer b) {
    							if (Server.npcHandler.npcs[c.oldNpcIndex] != null) {
     								Server.npcHandler.npcs[c.oldNpcIndex].gfx0(2264); // 1738
    								c.SSPLIT = false;
    							}
    				        		b.stop();
    						}
    					}, 500);
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Sep 2011
    Posts
    100
    Thanks given
    5
    Thanks received
    5
    Rep Power
    29
    Quote Originally Posted by brkownz View Post
    Why the fuck are you calling this a 'memory leak' lmfao.
    Lol this. A memory leak is code that will cause java to use more memory than supposed to, not when an exception has been caught. Do what brkownz told you.
    Reply With Quote  
     

  5. #5  
    Extreme Donator


    Join Date
    Oct 2006
    Posts
    1,370
    Thanks given
    64
    Thanks received
    197
    Rep Power
    426
    Do what they said, and check if c.oldNpcIndex is actually given a value.


    ~flow@hacking . rs
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [pi][rep++][thank] memory leak
    By sexyrussian in forum Help
    Replies: 15
    Last Post: 11-22-2011, 05:55 AM
  2. Memory leak $50
    By Wizard ebodA in forum Buying
    Replies: 2
    Last Post: 11-10-2011, 06:12 PM
  3. Memory leak
    By Wizard ebodA in forum Help
    Replies: 2
    Last Post: 11-05-2011, 07:05 PM
  4. memory leak
    By Mickt3 in forum Help
    Replies: 8
    Last Post: 07-26-2011, 08:57 PM
  5. [pi] Int Memory Leak [$]
    By Jorz in forum Requests
    Replies: 4
    Last Post: 07-25-2011, 06:29 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •