Page 1 of 2 12 LastLast
Results 1 to 25 of 28

Thread: Can't allocate DIB handle error

  1. #1
    Join Date
    Feb 2006
    Location
    Belgium
    Posts
    3,137
    Mentioned
    3 Post(s)
    Quoted
    5 Post(s)

    Default Can't allocate DIB handle error

    Hey everyone,

    It has been quite a while since I last posted here, this being because it was made very clear that I'm not exactly welcome here anymore. However, I had something important to share... I was recently pondering about the "Can't allocate DIB handle" error for which I've received quite a lot of heat because I could never find what actually caused it... I thought I had at one point, but it appeared that I had not afterwards. This error is thrown by SCAR when it can't allocate a DIB handle, obviously, what this means though, is that Windows won't allow the application to create any more bitmaps. There's few reasons what could possibly trigger this, the only viable reason is that SCAR would be creating bitmaps in it's memory space and not free them afterwards, which eventually would pile up until Windows gets fed up with it and refuses to allow any more to be created. So, I went looking in SCAR's source for any bitmaps I might not be freeing, though me and kaitnieks never really left that many memory leaks and I fixed most of the leaks in there years ago. And my search came up empty. So I started thinking... SCAR's plugin system works in a way that plugins are loaded to share the same memory space SCAR does, and this error has as far as I know only been known to occur for SRL users... So I turned my attention towards the SRL plugins, and I found this: http://villavu.com/repositories/srl-...izzyPlugin.dpr, if you would scroll down to CreateTPAFromBMP, you'll notice a bitmap "Bitmappie", being created without being freed afterwards, now if this function is called repeatedly enough, this would cause the very problem of "Can't allocate DIB handle" in SCAR. So my conclusion is, I'm not sure if it's the actual cause, but I really can't find anything else that could cause it, unless SCAR is actually handling too many bitmaps at once, but that also seems very unlikely, because that would be a shitload of bitmaps... But in any case, it has to be fixed because it creates a serious memory leak in SCAR's memory space.

    Yours truly,
    Freddy.

  2. #2
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    To think of it, I havent gotten the problem much lately.

    Quote Originally Posted by Freddy1990 View Post
    this being because it was made very clear that I'm not exactly welcome here anymore.
    Whats with that?
    There used to be something meaningful here.

  3. #3
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Cheers, thanks for posting this!

    Its appreciated.

    For the record, this is already fixed in Simba, unknowingly I guess.

    I will fix it later for SCAR.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  4. #4
    Join Date
    Aug 2006
    Location
    Belgium
    Posts
    149
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Wall of text crits you for 9001!

    On a more serious note:
    Why aren't you welcome here anymore?
    o/

  5. #5
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    This is only called in one place in SRL. In CreateTPAFromText. CreateTPAFromText is only called in Players.scar, to initialize the Player's nick TPA. SRL uses it only for initialization. (As far as my quick grep could show anyway)
    So unless some scripts use this extensively, this can't be the cause of the errors in SCAR.
    Last edited by Wizzup?; 04-20-2010 at 01:33 PM.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  6. #6
    Join Date
    Oct 2006
    Posts
    1,071
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Woo hi freddy! Why aren't you welcome here anymore

  7. #7
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    I actually get the DIB handle error when i try to read text, like hovering a skill and reading the text.
    There used to be something meaningful here.

  8. #8
    Join Date
    May 2007
    Location
    Ohio
    Posts
    2,296
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Wizzup? View Post
    This is only called in one place in SRL. In CreateTPAFromText. CreateTPAFromText is only called in Players.scar, to initialize the Player's nick TPA. SRL uses it only for initialization. (As far as my quick grep could show anyway)
    So unless some scripts use this extensively, this can't be the cause of the errors in SCAR.
    Still should be freed. :3

  9. #9
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Happens (I've noticed) with ChooseOption, too, Wizzup. If you search for text before it's there it seems to happen (for me at least).

  10. #10
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    I think my choose option uses CreateTPAFromText....
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  11. #11
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    You're always welcome, Freddy.


  12. #12
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    I think my choose option uses CreateTPAFromText....
    Doubt it:

    Code:
    Search "CreateTPAFromText" (7 hits in 2 files)
      C:\Remake\Includes\srl\SRL\core\Math.scar (6 hits)
    	Line 6: // * function CreateTPAFromText(Txt : string; Chars : string) : TPointArray; // * by Raymond
    	Line 7: // * function CreateTPAFromText(Txt : string; Chars : Integer) : TPointArray; // * by Raymond
    	Line 42: function CreateTPAFromText(Txt : string; Chars : string) : TPointArray;
    	Line 46: function CreateTPAFromText(Txt : string; Chars : string) : TPointArray;
    	Line 54: function CreateTPAFromText(Txt : string; Chars : Integer) : TPointArray;
    	Line 58: function CreateTPAFromText(Txt : string; Chars : Integer) : TPointArray;
      C:\Remake\Includes\srl\SRL\core\Players.scar (1 hits)
    	Line 121:     Players[I].NickTPA := CreateTPAFromText(Players[I].Nick, UpChars);
    Everything else just uses
    Code:
    function LoadTextTPA(Text: string; Chars: Integer; var height: integer): TPointArray;
    var
      DC: HDC;
      CTS, w, h :INteger;
      BMP: Integer;
    begin;
      BMP := CreateBitmapMaskFromText(Text,Chars);
      DC := GetClientCanvas.Handle;
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(0);
      GetBitmapSize(BMP,W,H);
      SetTargetDc(GetBitmapDc(BMP));
      FindColorsTolerance(Result,clwhite,0,0,w+1,h+1,0);
      height := h - 1;
      SetTargetDC(DC);
      ColorToleranceSpeed(CTS);
      FreeBitmap(BMP);
    end;
    Good find however, silly mistake on my side :$
    Verrekte Koekwous

  13. #13
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    Don't let personal grudges interfere with your place here, Freddy. Sure it is so we are working on our own macroing system, but really that shouldn't be an issue from a professional point of view.

    But I understand nevertheless.
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  14. #14
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Smile

    Thanks for pointing this out Fred, and like Fawki said, i think you have a place in here (: Even if Simba comes around, it doesn't change anything what you
    have done for this community.

    And it's not all about Scar and Simba. Heh

    ~Home

  15. #15
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    You're only as welcome as you want to be. It's entirely up to you. (If you don't act nice to people, they won't be nice to you either)
    The choice you made not to come to SRL for awhile is entirely yours, and was not forced upon you.

    I'm sorry I'm not being nicer ( ), but this isn't the first time you're saying everyone is against you... It annoys me that you constantly make yourself look like you're the innocent guy; like you're a victim of some conspiracy, which simply isn't the case.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  16. #16
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    I get dib handle error when I use choose option and there has been something wrong with targetting the client... Sometimes (rarely) I also used to get it when handling with big TPoint arrays...(such as getting all colors from the array).

  17. #17
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Yet you must admit that the open-sourceness of the plugin has helped you to find this bug, just saying.
    Verrekte Koekwous

  18. #18
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Quote Originally Posted by mastaraymond View Post
    Yet you must admit that the open-sourceness of the plugin has helped you to find this bug, just saying.
    A bit offtopic but I just had an image in my head of you being "Ray William Johnson" because of the "just saying"
    There used to be something meaningful here.

  19. #19
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    I get dib handle error in this line:
    Code:
    FindColorsTolerance(TPA, 4016722, B.X1, B.Y1, B.X2, B.Y2, 0);
    in text.scar... Actually i think there is something wrong with getclientdimensions as B.X2 and B.Y2 is declared with that...

    And i just got these values for them before the error:
    B.X2: 1244528
    B.Y2: 2089870419

  20. #20
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    This is only called in one place in SRL. In CreateTPAFromText. CreateTPAFromText is only called in Players.scar, to initialize the Player's nick TPA. SRL uses it only for initialization. (As far as my quick grep could show anyway)
    So unless some scripts use this extensively, this can't be the cause of the errors in SCAR.
    causes me to jump into rageshoes and download kbot

    I cant remember how did it exactly happen, but after doing some disabling/enabling of smart, restarting of script etc I had to move the crosshair onto smart to get me some coords, and if I did it like many times it gave that error right away...

    SRL uses it only for initialization. (As far as my quick grep could show anyway)
    And chooseoption which is only like the second most used function?

  21. #21
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    I have the same problem as antti mies..
    There is a problem with GetClientDimensions
    That's what causes it. I get the error every time I call GetMMLevels and GetClientDimensions is used in that function.
    I get the error here:
    Code:
    FindColorsTolerance(P, Colors[i], SearchBox.x1,SearchBox.y1,SearchBox.x2,SearchBox.y2, 30);
    Please fix this in scar-prerelease asap, Freddy!

  22. #22
    Join Date
    May 2007
    Location
    Ohio
    Posts
    2,296
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Something is just causing SCAR to lose focus on Runescape, that is what causes the numbers from GetClientDimensions

  23. #23
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by Timer View Post
    Something is just causing SCAR to lose focus on Runescape, that is what causes the numbers from GetClientDimensions
    Yea, well it still needs to be fixed to prevent SCAR from crashing and people loosing valuable work.
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  24. #24
    Join Date
    May 2007
    Location
    Ohio
    Posts
    2,296
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by noidea View Post
    Yea, well it still needs to be fixed to prevent SCAR from crashing and people loosing valuable work.
    Who ever said it is scar?

  25. #25
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by Timer View Post
    Who ever said it is scar?
    Well, if it occurs in rs_getUptext, what else can it be? GetClientDimensions returning rubbish surely isn't the scripters fault either.
    IOW: Give your post some thought before you post...



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •