473,725 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Array.sort return "out of memory" in IE and Mozilla


let's say you have:

var games = new Array();
games[gameNum] = new GAME(gameNum, rotNum1, rotNum2, ... );

(

so a sparsley populate array which enables me to locate a game usin
the game number without having to implement a "search" function on th
games array

games[4325] = new GAME(4325, 201, 202, 'Baseball', 'MLB', ... );

).

games.sort();

... works but gives me a sort that I don't care about. Worse than tha
it "re-indexes" the array and now the first element is 0, the nex
element is 1, and so on. I can't locate a game by the gamenumbe
without implementing a search function.

so here comes a sort function (for the first problem, I deal with th
renumbering by creating a temp array, copying things over, sorting th
temp array and bringing everything back in the original array. nast
business).

function sortByRot( gameA, gameB )
{
return gameA.rotNum1 - gameB.rotNum2;
}

which I was hoping would let me do:

games.sort(sort ByRot);

But in IE and Mozialla I get

"An exception of type "Microsoft JScript runtime error: Out of memory
was not handled." message. Now I'm facing the unpleasant task o
handling the sort myself.

Any help would be most welcome.

Regards,
Gamble
-
gamble

Jul 23 '05 #1
3 3992
gambler <ga************ @mail.forum4des igners.com> writes:

....
so a sparsley populate array which enables me to locate a game using
the game number .... games.sort();

.. works but gives me a sort that I don't care about.
What result do you want?

Sorting a sparse array will put all the defined elements before the
undefined ones, by design.

It will, obviously, change the order of elements, so they are (most
likely) no longer positioned where they originally were.
Worse than that it "re-indexes" the array and now the first element
is 0, the next element is 1, and so on.
Yes, that is what "sort" does on sparse arrays.
I can't locate a game by the gamenumber without implementing a
search function.
What did you want the sort function to do instead?
so here comes a sort function (for the first problem, I deal with the
renumbering by creating a temp array, copying things over, sorting the
temp array and bringing everything back in the original array. nasty
business).
Perhaps necessary, but hard to tell without knowing what you want.
Some times, it's enough to sort an array of indices, with an
appropriate comparison function.
function sortByRot( gameA, gameB )
{
return gameA.rotNum1 - gameB.rotNum2;
}
(maybe better named "compareByR ot")
which I was hoping would let me do:

games.sort(sort ByRot);
Sounds reasonable. It will still put all the defined elements before
the undefined ones..

But in IE and Mozialla I get

"An exception of type "Microsoft JScript runtime error: Out of memory'
was not handled." message.
It's unlikely that that specific error message was produced by Mozilla :)

How much memory do you have? How many elements are there in your sparse
array?
Now I'm facing the unpleasant task of handling the sort myself. Any help would be most welcome.


If you could show us the offending page, and say how you want the
data manipulated, then I'm sure we'll have a suggestion.

--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #2
gambler wrote:
let's say you have:

var games = new Array();
games[gameNum] = new GAME(gameNum, rotNum1, rotNum2, ... );

(
I think you have to define a Constructor

function GAME(gameNum){
this.gameNum=ga meNum;
for(a=1;a<argum ents.length;a++ ){
this["rotNum"+a]=arguments[a]
}
}

Something like that.

or:

games[gameNum] = [gameNum, rotNum1, rotNum2, ... ]

Mick

so a sparsley populate array which enables me to locate a game using
the game number without having to implement a "search" function on the
games array

games[4325] = new GAME(4325, 201, 202, 'Baseball', 'MLB', ... );

).

games.sort();

.. works but gives me a sort that I don't care about. Worse than that
it "re-indexes" the array and now the first element is 0, the next
element is 1, and so on. I can't locate a game by the gamenumber
without implementing a search function.

so here comes a sort function (for the first problem, I deal with the
renumbering by creating a temp array, copying things over, sorting the
temp array and bringing everything back in the original array. nasty
business).

function sortByRot( gameA, gameB )
{
return gameA.rotNum1 - gameB.rotNum2;
}

which I was hoping would let me do:

games.sort(sort ByRot);

But in IE and Mozialla I get

"An exception of type "Microsoft JScript runtime error: Out of memory'
was not handled." message. Now I'm facing the unpleasant task of
handling the sort myself.

Any help would be most welcome.

Regards,
Gambler

--
gambler

Jul 23 '05 #3
gambler wrote:
But in IE and Mozialla I get
You mean _Mozilla_?
"An exception of type "Microsoft JScript runtime error: Out of memory'
was not handled." message. Now I'm facing the unpleasant task of
handling the sort myself.

Any help would be most welcome.
This is an ActiveServer Pages error message, not a client-side one (which is
why it not only shows up in IE) and probably not related to scripting.

You should have posted the relevant snippets of your constructor code.
--
gambler


Signatures are to be separated with a line containing DashDashSpaceNe wline.
PointedEars
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6663
by: Snake Djip | last post by:
Hi, I have a problem with a home-made DLL used in an ASP environment. It is coded in VB6, apartment-threaded. The DLL returns a binary PNG stream (an image). I use it with ASP's Response.BinaryWrite to display a dynamic image on a web page. The server is Windows 2000 SP4.
0
4068
by: John Bonds | last post by:
I have designed a multi-threaded application that manipulates images (CCITT Group 4 TIFF Images). I'm getting some strange behavior and I'm wondering if anyone else is seeing the same thing. I run a batch process that reads in pages of one of these TIFF files, separates them out into different TIFF files, saves them to a file (in a new thread) and disposes properly of all the memory that was used. I run this batch process and monitor the...
0
1144
by: lennart | last post by:
Greetings, the last three days I have started to get entries like: 2005-10-05-16.51.44.615996+120 I20328552G471 LEVEL: Warning PID : 11244 TID : 3006253568 PROC : db2agent (NYA) INSTANCE: vhsinst NODE : 000 DB : NYA APPHDL : 0-306 APPID: D5996B4A.C8BC.08D7A5144053 FUNCTION: DB2 UDB, sort/list services, sqlsReservePrivateSpace, probe:10 MESSAGE : Invalid private sort memory...
10
4701
by: schears | last post by:
Why? Running on windows 2000 with all updates, 2G Memory, 117G Hard Drive space available. This was not an issue until I added some code to two of my c files. Any suggestions? Thanks
1
2275
by: Alex Chan | last post by:
Hi Group, I have written a window service wtih SAP.NET Connector which is to fulfil request from SAP client. SAP client will call a function exposed by my window service that has a big "out" parameter. That "out" parameter is of class SAPTable, you can regard that as DataTable. As everytime SAP client issue request to my window service, it will connect to oracle and do some searching and return the result in a SAPTable. I did a volume...
3
2077
by: comp.lang.php | last post by:
I have a counter that evokes the "Three Strikes You're Out" rule.. if you make more than N mistakes it auto-resets to avoid flooding $_SESSION with attempt after attempt, etc. However, the counter never advances beyond 1! // HANDLE THE PART WHERE THE STUDENT INFORMATION WILL BE UPDATED OR SEARCHED if (is_array($_POST) && @sizeof($_POST) > 0) {
4
6937
by: lawrence k | last post by:
I've a jpeg image that is 514k, which doesn't strike me as very large. Yet I'm running out of error when I try to resize it: Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 12288 bytes) in /home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/resizeImageToSquare.php on line 82 How can I protect against out-of-memory errors?
16
4183
by: saurabhnsit2001 | last post by:
The following program doesn't "seem" to print "hello-out". (Try executing it) #include <stdio.h> #include <unistd.h> int main() { while(1) { fprintf(stdout,"hello-out");
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.