'new' limit
-
Hi, all you happy coders I Hope somebody can help me with this problem I am having: In my program i try to allocate about 500KB (in smaller pieces) with the new operator, but it hangs in some function called '__sbh_alloc_block'... Is this because I can't get more memory from windows...? Thanks in advance, Erik Hammar :confused:
-
Hi, all you happy coders I Hope somebody can help me with this problem I am having: In my program i try to allocate about 500KB (in smaller pieces) with the new operator, but it hangs in some function called '__sbh_alloc_block'... Is this because I can't get more memory from windows...? Thanks in advance, Erik Hammar :confused:
Erik Hammar wrote: i try to allocate about 500KB (in smaller pieces) From that sentence I assume you have a loop of some kind where you repeatedly call new till you get 500 KB is several smaller blocks [or so we assume] Now are you sure your loop is looping the right number of times. perhaps it's a sort of endless loop! Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut
-
Erik Hammar wrote: i try to allocate about 500KB (in smaller pieces) From that sentence I assume you have a loop of some kind where you repeatedly call new till you get 500 KB is several smaller blocks [or so we assume] Now are you sure your loop is looping the right number of times. perhaps it's a sort of endless loop! Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut
No it's not a loop... I create instances of about 5 classes, which each allocate one or two blocks of memory...
-
No it's not a loop... I create instances of about 5 classes, which each allocate one or two blocks of memory...
After how many sucessful 'new's do you get the error? Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut
-
After how many sucessful 'new's do you get the error? Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut
I get it after 5 times... ... byte *bmpdata = new byte[256*240]; memsize 1 > 128KB class1 = new CClass1(memsize1) (inside CClass1's constructor) data = new byte[memsize1] memsize 2 > 128KB class2 = new CClass2(memsize2) (inside CClass2's constructor) data = new byte[memsize2] class3 = new CClass3 - this is where it crashes (before the actual constructor of CClass3) ... Seems really strange to me, that this hangs the program, and not only gives me a NULL pointer!
-
I get it after 5 times... ... byte *bmpdata = new byte[256*240]; memsize 1 > 128KB class1 = new CClass1(memsize1) (inside CClass1's constructor) data = new byte[memsize1] memsize 2 > 128KB class2 = new CClass2(memsize2) (inside CClass2's constructor) data = new byte[memsize2] class3 = new CClass3 - this is where it crashes (before the actual constructor of CClass3) ... Seems really strange to me, that this hangs the program, and not only gives me a NULL pointer!
Well I cant even make any guesses from that. But try creating the CClass3 object first and then create CClass1 and CClass2. Now if it still gives an error when you create the CClass3 the problem must be with something you are doing in the CClass3 constructor, but if the trouble happens with the third new then we are again nowhere :-( Try this out anyway. And if possible post the CClass1/2/3 constructor code as well. Also how is the data member-variable defined in these classes? Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut
-
Well I cant even make any guesses from that. But try creating the CClass3 object first and then create CClass1 and CClass2. Now if it still gives an error when you create the CClass3 the problem must be with something you are doing in the CClass3 constructor, but if the trouble happens with the third new then we are again nowhere :-( Try this out anyway. And if possible post the CClass1/2/3 constructor code as well. Also how is the data member-variable defined in these classes? Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut
Strange... moving the class3 creation code to the top, seems to eliminate the problem. That's strange, because the class3 doesn't even touch the class1 and class2 Anyway, Thanks for your concern!
-
Strange... moving the class3 creation code to the top, seems to eliminate the problem. That's strange, because the class3 doesn't even touch the class1 and class2 Anyway, Thanks for your concern!
Erik, I think you should not be complacent about the error being removed. We still don't know why it crashed before. A bug that has been hidden but not removed can be very deadly. Good luck. Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut