RE: 2.4 Official -- memory stuff
- Posted by Andy Serpa <ac at onehorseshy.com> Jul 07, 2003
- 483 views
Robert Craig wrote: > > > Andy Serpa wrote: > > No tweak on the memory allocation? I've got a growing list of > > "un-runnable" programs with 2.4. Is this just a Windows ME problem? > > You said you had no trouble under XP? > > I had no trouble on my 256Mb RAM Windows XP system. > In fact, your program ran quite fast. > > I couldn't see any easy tweak to help you out on ME. > It was also very slow on my 64Mb ME system > (even after scaling things down). > Some things you can do: > > - reduce the size of the sequences > - make more use of integers rather than floating-point > - create sequences at their final size, rather than > "growing them" with append or concatenation > > In general, 2.4 is faster at allocating memory than 2.3. > However your program really mangles the system heap. > On Windows, 2.3 uses Watcom's heap manager, but > to make Euphoria .dll's work reliably I must use the > system heap, so that's what 2.4 does. The system heap > might be using an extra 4 bytes per floating-point number. > I'm not sure. > This has become a more general problem than I thought at first. I had to break up one of my programs so the "heavy-lifting" is done with a 2.3-translated program instead of 2.4 (other parts make use of the 2.4 features which I don't want to give up -- like user-defined types being called w/ translator). For instance, here's a problem: I'm using Diamond, and the 2.3 part of the program creates a bunch about 150 Diamond entities. (This program takes 10x longer to run in 2.4 -- that's after rewriting the whole algorithm. Before it would never finish at all.) Each entity has one property which will hold a somewhat large sequence (each entity takes about 1/3 MB on disk after converting to byte code). The goal would be to hold all these entities in RAM at the same time. I've got plenty enough RAM to do that. Problem is, even if I create the entities in 2.3, I can't even load them in 2.4 (without it taking forever and a day)! That's because they're stored on disk as bytecode and after the bytecode for an entity is read from disk, the entity needs to be restored with the Diamond function restore_entity(). Apparently this transformation is enough to "mangle the heap" (unless there really is just an outright bug somewhere in 2.4) and if I try to load in the rest of the entities each one takes longer & longer. So now if I want to have access to all the entities I have to do something like store the bytecode for each one in an EDS database or something and never have more than one (or a few, anyway) "restored" at a time. As I said before, there seems to be a definite threshold for this -- if I load in one entity everything is fine. And if I destroy that entity before loading in the next one everything is fine. But if I load in 10 or so then that's all she wrote. So now I'm in the position where I would have to restore each entity *EACH* time I want to use it, which of course causes a different kind of slowdown -- what I really want is access to all of them at once. There is basically no way around it -- such a program just doesn't work in 2.4 (on this platform) in any practical sense if I can't even get the objects in memory. Bottom line: it seems that with ME/98/95, any program which uses more than a little memory in any sort of flexible way is doomed. Since one of the main features of Euphoria is supposed to be flexible use of data, garbage collection, etc., the price seems rather high. I am effectively limited to programs which use no more than a few MBs of RAM on a machine which has 512 MB available! I can't be the only one who is going to have a problem with this...