TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Michael Duffy
date: 1994-11-02 18:06:54
subject: intelligent memory allocation?

Ok, so what exactly is the most intelligent way to allocate memory if you
don't know exactly what you requirements will be?  Apparently malloc isn't
giving me any single allocations larger than 32K (Watcom v.10.0), so I guess
that I have to use DosAllocateMem, assign this memory with DosSubSetMem, 
and then allocate it with DosSubAllocMem.  However, how do you decide on 
how much memory to initially allocate?  Should you just pick a goodly large 
number (say, 100Meg) leaving the memory uncommitted till you need it, then 
grow the suballoced heap?  Should you take the 512Meg that your application 
is limited to?  Or should you pick a smaller amount to allocate, based on 
calculations that I don't know about?  
   Do you handle memory differently depending on the application?  For 
instance, one of my applications will have sets of linked lists (the length 
of which I don't know) where memory will be allocated in lots of tiny chunks.
Another application will have large bitmapped images, eating up 200k+ chunks
each.  Is it better to use suballocated memory in one case and plain old
nonshared memory in another?

  Thanks to all who are wading through my various posts.  I'm in the process
of joining the Developers' Assistance Program, and then I will get the 
Developer's Connection CD subscription.   However I'm guessing it is going 
to be a month or more before I get all of that ironed out.  *sigh*

Still trying to learn OS/2,
Michael Duffy

... ARRRRRGGGHHH!!!! ... Tension breaker, had to be done.
--- GEcho 1.10+

* Origin: Knight Mare 405 672 5644 (1:147/3006)
SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 410 413
SEEN-BY: 711/430 807 808 809 934 942 949 712/353 623 713/888 800/1
@PATH: 147/3006 1032 3615/50 229/2 12/2442 711/409 54/54 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.