mfc >> Please help: 4G Memory problem

by AA » Thu, 20 Nov 2003 22:37:26 GMT

I know that Win32 OS such as XP and Win2000 only support 4G memory. If I
want ot write a program that can support larger than 4G memory
allocation(eg. The program need allocated 6G memory), what should I do?
If I use a Win200Advance Server, do I need some special tecnnique to write
the program?
My situation:
In the program, I use a CMAP to store many CPtrList. Each CPtrlist store a
large aamount of allocated data.
I use this method to store over 4.G data , is that work?

Thanks

Anthony




mfc >> Please help: 4G Memory problem

by Mihajlo Cvetanovic » Thu, 20 Nov 2003 23:05:43 GMT





And there was a time when people thought 640KB would be all the memory
a we'll ever need...

The problem here is MAX_INT = 4GB, so with a long or int you just
can't have more than 4GB of memory. You would need a 64 bit OS.

You better do your thing on hard disk (like OS does with virtual
memory). Each CPtrList could be one file, and each file can have more
than 4GB, if you still need that. There's more programming involved,
but you don't have a restriction on the type of the operating system.




mfc >> Please help: 4G Memory problem

by AA » Fri, 21 Nov 2003 01:44:04 GMT

As in MSDN, I read a message siad that a process in 32-bit OS only support
up to 4G memory. So, I think how to make a program that need allocate more
than 4G memory.

"Mihajlo Cvetanovic" < XXXX@XXXXX.COM >


I
do?
write
store a




Please help: 4G Memory problem

by Stephen Kellett » Fri, 21 Nov 2003 02:47:04 GMT

In message <uUuW$ XXXX@XXXXX.COM >, AA
< XXXX@XXXXX.COM > writes

Take a look at Windows Address Extensions. The server versions of the OS
allow you to use more memory but you must use the addressing extensions
to map a window on to the larger memory area. This also assumes your
motherboard has the appropriate hardware to provide for more memory.
--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk
RSI Information: http://www.objmedia.demon.co.uk/rsi.html


Please help: 4G Memory problem

by Joseph M. Newcomer » Fri, 21 Nov 2003 19:36:17 GMT

pplication memory? Not a chance. Buy an AMD64. In practice, you won't even get 1GB of
contiguous memory except on good days; there is a hard 2GB limit on most systems. If you
needed only 3GB, I'd suggest booting a configuraiton with the /3GB boot option (which
means you can probably get 2GB on a good day). Note that an AMD64 running 64-bit windows
gives you nearly the entire 4GB address space in user space, but you are one of the people
who really needs the AMD64. I'm not sure Win32 supports the PAE extensions for machines
that can support more than 4GB of physical memory in any way that is useful to
applications. If so, that would require you build a really complicated representation of
your data, since you can't address anything above 2 or 3GB anyway (hey! We've just
invented segmented address space ALL OVER AGAIN!)

Good News: AMD64 systems are going for about $2500. There is an unfortunately small limit
(relative to the 64-bit address space) of 8TB of user space, but I think your 6GB will fit
comfortably in that.

Computation: at one point, Toshiba announced they were going to up their production of RAM
chips to 8M (2^23) per month. Assume these are 256M RAM chips (2^18). This means they
produce 2^41 bytes of storage per month. This means it would take them 2^23 months to
produce 2^64 bytes of memory, or, in other words, something over 699,000 years to populate
just ONE 64-bit address space. If these were 1MB chips, they could do it in just over
174,762 years. 1GB chips at that rate means it would only take 682 years of the entire
output of the factory. If we could harness the output of EVERY memory chip vendor (I think
there are about ten) and they all kept that production rate, we could populate one 64-byte
address space within a human lifetime. However, the current AMD64 has only 40 bits of
address line, which means you could completely populate an AMD64 with only two weeks of
the entire output of the Toshiba factory. I don't even want to THINK about the power
consumption required for 2^40 bytes of memory (for 1MB RAM chips, 2^20, you only need two
million chips to populate the 40-bit address space).

While 32 bits lets you address 4GB of RAM, it does not allow your program to get that much
memory. The upper 2B (or 1GB) is reserved for the OS.

Given how screwed up Intel is with the IA64 architecture, I think AMD is going to eat them
alive with the AMD64. I wouldn't take an Itanium if it were free; I will *buy* an AMD64. A
number of us are referring to it as "the 432 of this decade". If you don't remember the
IA432 architecture, it is no surprise. It failed utterly in the marketplace. But after 25
years or so, everyone who made that mistake is dead, retired, or senior management (the
first and last often being effectively the same), so new people have to make the same
mistakes all over again...
joe
On Thu, 20 Nov 2003 22:37:26 +0800, "AA" < XXXX@XXXXX.COM > wrote:


Joseph M. Newcomer [MVP]
email: XXXX@XXXXX.COM
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm


Please help: 4G Memory problem

by Stephen Kellett » Fri, 21 Nov 2003 22:10:24 GMT

In message < XXXX@XXXXX.COM >, Joseph M.
Newcomer < XXXX@XXXXX.COM > writes

Exactly what I thought when I read about PAE. What a nightmare. You must
be desperate to code using it.


Just about sums up how I feel. I've worked on Itanium boxes. Ugh.


LOL!

Never heard of the 432 (my first computer was a Vic-20), have heard of
the Titanic. I think "the reg" got it right when they nicknamed Itanium
"itanic".

Stephen
--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk
RSI Information: http://www.objmedia.demon.co.uk/rsi.html


Please help: 4G Memory problem

by Stephen Kellett » Fri, 21 Nov 2003 22:13:15 GMT

In message < XXXX@XXXXX.COM >, Joseph M.
Newcomer < XXXX@XXXXX.COM > writes

Where from? Got any web addresses? I've been looking but not found
anything useful. Have MS shipped the OS yet, rather than the compiler?


I look forward to those clever programming hacks storing data in the
upper 24 bits that aren't used like some "clever" people did with 68K on
the Mac/Atari-ST/Amigas. Oh the joy of porting those apps to later 68K
processors with the address lines functioning :-)

Stephen
--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk
RSI Information: http://www.objmedia.demon.co.uk/rsi.html


Please help: 4G Memory problem

by Joseph M. Newcomer » Sat, 22 Nov 2003 07:42:34 GMT

I saw systems being advertised at WinHEC, and running Win64. Last week I sat at one at the
Microsoft Driver Conference in Redmond, and it was clear that this is a product unit that
is shipping. I'm kind of waiting for Dell to produce one.

As for the 40 bits, this is only physical address lines. The 64-bit address still has to
be a full 64-bit address, and the h/o bits can't be used for any purpose (they will still
decode through the page maps, and cause an access exception) .

I remember converting programs on the IBM/360 that used the high-order 8 bits of the
address ("who would need more than 16MB of address space...") for data to run in the
32-bit IBM TSS/360 environment. Ecch.
joe




Joseph M. Newcomer [MVP]
email: XXXX@XXXXX.COM
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm


Please help: 4G Memory problem

by Tim Slattery » Mon, 24 Nov 2003 21:48:30 GMT





I did a bunch of that too, converting older programs using 24-bit
addresses to use the additional storage available under the newer
31-bit addressing available in OS/ESA (or was it OS/MVS, it's been a
long time). 31-bit addressing is not a typo, the high-order bit was
used as a switch in special branch commands to set the mode to 24-bit
or 31-bit addressing.

When the world was young and core memory was scarce and expensive, the
lower three bytes in a word would be used to store an address, and the
high-order byte would be used for a small array of flags or other
data. You could load that word into a register for a branch statement,
and be sure that the top byte would be ignored. Converting to 31-bit
addressing screwed that scheme up completely and totally!

--
Tim Slattery
MS MVP(DTS)
XXXX@XXXXX.COM


Please help: 4G Memory problem

by Joseph M. Newcomer » Tue, 25 Nov 2003 11:34:00 GMT

It turns out the reason that IBM introduced 24-bit support into TSS (having originally
created only 32-bit support) was that they could not convert the PL/1 compiler to run on
TSS, because it was (a) written in assembler and (b) used those high-order 8 bits
EVERYWHERE.

I just read a press release saying that Dell was passing on the AMD64. Sigh. But I went to
the AMD site and found a whole bunch of vendors who claim to be shipping AMD64 systems.
One that had a price gave $1999, although I don't recall what its configuration was.
joe





Joseph M. Newcomer [MVP]
email: XXXX@XXXXX.COM
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm


Please help: 4G Memory problem

by Stephen Kellett » Tue, 25 Nov 2003 18:24:00 GMT

>I just read a press release saying that Dell was passing on the AMD64.

Indeed. Intel must have them in some mighty headlock.

More fool Dell.

Are Intel planning any form of 64 bit x86?
--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk
RSI Information: http://www.objmedia.demon.co.uk/rsi.html


Please help: 4G Memory problem

by Tim Slattery » Tue, 25 Nov 2003 21:37:39 GMT





Not entirely sure what you mean by "64 bit x86". Intel has been
selling the Itanium 64-bit processor for a while now, and there is an
XP system for it. XP for AMD's 64-bit Opteron will appear next year, I
think.

--
Tim Slattery
MS MVP(DTS)
XXXX@XXXXX.COM


Please help: 4G Memory problem

by Stephen Kellett » Tue, 25 Nov 2003 22:42:43 GMT

In message < XXXX@XXXXX.COM >, Tim Slattery
< XXXX@XXXXX.COM > writes

x86 extended to handle 64 bits. Same as AMD64.


Itanium is not x86 compatible. Its expensive, slow and eats power
stations for breakfast. (OK the last one is an exaggeration...). A truly
awful processor. I worked with a beta box for nearly 2 years porting a
CAD application. This processor is DOA.

There is something else wrong with Itanium that you never see people
comment on. It has the concept of a local address pointer (can't
remember the real name) which is the base address from which all other
pointers work. This is because pointers are not stored as 64 bits, but a
shorter length, on the grounds that most of the time the pointers will
be within XXGB. To get to addresses you can't reach with your pointer
you need to choose a new local address pointer (I can hear you vomiting
at the back).
End Result: A segmented addressing scheme because your pointer can't
point to every address in memory. I haven't explained this well (I last
worked on Itanium over 2 years ago, hence the unclear explanation), but
when I saw this I started thinking of DOS and WIN16 _huge_ pointers.
Dreadful. I hope the AMD64 doesn't do something similar.

AMD are going to wipe the floor with Intel on this.

Stephen
--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk
RSI Information: http://www.objmedia.demon.co.uk/rsi.html


Similar Threads

1. Very perculiar problem involving dynamic memory, please help

2. Please help on this problem, Pretty Please - CSharp/C#

3. Serialization Problem - REPOST - PLEASE PLEASE HELP!

I posted this last week, but didn't get any reply. I'm trying again now, 
because I'm getting desperate - I've tried everything I can think of myself. 
PLEASE help somebody.

I've made an inherited ListView control with a customized ColumnHeader Type.
I've overwritten the Columns property with a collection of my custom
ColumnHeader items. Now I would like to implement serialization so that
columns are persisted from designtime to runtime. But I cannot get it to
work.

I think it's because I don't know how to implement the type converter
correctly. Here's my suggestion for the type converter. Sample code for the
ListView, ColumnHeaderCollection and ColumnHeaderItem is supplied below. Can
anybody tell me what's wrong?

I've got a small test project (C# 2005) that I've stripped of everything but 
the important part (the collection) - I cannot get the serialization to 
work. I add columns at designtime, but no matter what, the columns are not 
persisted to runtime. If anybody has got the time to help me, I can mail the 
test project. I would REALLY appreciate any help.

Cheers, Johnny J.



public class MyListViewColumnConverter : TypeConverter
{
public override bool CanConvertTo
(ITypeDescriptorContext context, Type destinationType)
{
if (destinationType == typeof(InstanceDescriptor))
{
return true;
}
return base.CanConvertTo(context, destinationType);
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo
culture, object value, Type destinationType)
{
if (destinationType == typeof(InstanceDescriptor) && value is
MyListViewColumn)
{
MyListViewColumnitem = (MyListViewColumn)value;
ConstructorInfo ci = typeof(MyListViewColumn).GetConstructor(new Type[]
{ });
if (ci != null)
{
return new InstanceDescriptor(ci, null, false);
}
}
return base.ConvertTo(context, culture, value, destinationType);
}
}

**********************************************************
Listview, ColumnheaderCollection, ColumnHeaderItem code:


namespace MyListView
{
public class MyListView : ListView
{
private MyColumnHeaderCollection myListViewColumnHeaders = null;
public MyListView()
{
myListViewColumnHeaders = new MyColumnHeaderCollection(this);
//Other Code
}
public MyListView(IContainer container)
{
myListViewColumnHeaders = new MyColumnHeaderCollection(this);
container.Add(this);
//Other Code
}
[Localizable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[Editor("System.Windows.Forms.Design.ColumnHeaderCollectionEditor,
System.Design, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
[MergableProperty(false)]
public new MyColumnHeaderCollection Columns
{
get { return myListViewColumnHeaders; }
}
//Other Code
}
[DesignTimeVisible(false)]
public class MyColumnHeaderCollection : ListView.ColumnHeaderCollection
{
private SortedList columnList = new SortedList();
public new MyListViewColumn this[int index]
{
get
{ return (MyListViewColumn)columnList.GetByIndex(index); }
}
public override ColumnHeader Add(string str, int width, HorizontalAlignment
textAlign)
{
MyListViewColumn column = new MyListViewColumn(str, width, textAlign);
this.Add(column);
return column;
}
public override int Add(ColumnHeader column)
{
return this.Add(new MyListViewColumn(column));
}
public override void AddRange(ColumnHeader[] values)
{
for (int index = 0; index < values.Length; index++)
{
this.Add(new MyListViewColumn(values[index]));
}
}
public int Add(MyListViewColumn column)
{
int retValue = base.Add(column);
columnList.Add(column.ColumnID, column);
return retValue;
}
public new void Remove(ColumnHeader column)
{
base.Remove(column);
columnList.Remove(((MyListViewColumn)column).ColumnID);
}
public new void RemoveAt(int index)
{
ColumnHeader column = this[index];
this.Remove(column);
}
public new void Clear()
{
base.Clear();
columnList.Clear();
}
}
[DesignTimeVisible(false)]
[TypeConverter(typeof(MyListViewColumnConverter))]
public class MyListViewColumn : ColumnHeader
{
private int m_ColumnID = 0;
private static int autoColumnID = 0;
public MyListViewColumn()
{
Initialize("", 60, HorizontalAlignment.Left);
}
public MyListViewColumn(string str, int width, HorizontalAlignment
textAlign)
{
Initialize(str, width, textAlign);
}
public MyListViewColumn(ColumnHeader column)
{
Initialize(column.Text, column.Width, column.TextAlign);
}
private void Initialize(string str, int width, HorizontalAlignment
textAlign)
{
base.Text = str;
base.Width = width;
base.TextAlign = textAlign;
m_ColumnID = autoColumnID++;
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public int ColumnID
{
get { return m_ColumnID; }
}
}
} 


4. please help... ...me learn C++ please please please :)