Pocket PC Forum / Developers / Platform Builder / September 2003
VirtualAlloc still has a 32MB limit?
|
|
Thread rating:  |
jj3000 - 19 Aug 2003 23:03 GMT Hi,
I have converted my Malloc calls to virtualAlloc() in order to allocate more than 32MB of total memory to use in my application, (I am using CE.NET 4.1)
but it seems no matter what I do, a mix Malloc and VirtualAlloc in ANY combination is still restricted to 32MB, total.
For example, the following should allocate 32MB of memory, because each one is 16MB (greater than 2MB) it should allocate in the large shared memory area:
x = (double *) VirtualAlloc(NULL, 2000000 * sizeof(double), MEM_COMMIT, PAGE_READWRITE); if (!x) AfxMessageBox(_T("not enough memory"));
y = (double *) VirtualAlloc(NULL, 2000000 * sizeof(double), MEM_COMMIT, PAGE_READWRITE); if (!y) AfxMessageBox(_T("not enough memory (2)"));
But if I try to allocate more memory after this, the virtualAlloc returns false. My process viewer shows the program is using 10KB, so the memory is allocated outside, but it still seem to have a 32MB limit.
If I replace one of the above calls with malloc, the behavior is the same, except the process viewer shows I'm using 16MB of the application's own memory region.
But still the program will not let me create more than 32MB of memory in any combination.
Of course, the system applet tells me I have 186MB Ram free for program memory. (256 MB Chip)
I'm really puzzled, this is supposed to work, I don't want to convert to memory mapped files if I don't have to.
TIA...
Geoff Smith - 20 Aug 2003 17:38 GMT 2000000 * sizeof(double) is not 32 MB!
 Signature Geoff Smith eMVP http://www.BSQUARE.com == "Of course, these are my opinions and mine alone."
> Hi, > [quoted text clipped - 39 lines] > > TIA... > if I try to allocate more memory after this, the virtualAlloc>returns false // validate parameters if (IsKernelVa (dwAddr) // invalid address? || !cbSize // size == 0? || ((cbSize >= (1<<VA_SECTION)) // size too big? (okay to reserver > 32M with && (dwSlot0Addr || (fdwAllocationType != MEM_RESERVE) || (fdwProtect != PAGE_NOACCESS))) || !(ulPgMask = MakePagePerms(fdwProtect, fIsKAddr))) { // invalid flag? KSetLastError(pCurThread, ERROR_INVALID_PARAMETER); return NULL; }
Make sense now? How about
if (((cPages * PAGE_SIZE >= 2*1024*1024) || (fdwInternal & MEM_SHAREDONLY)) && (fdwAllocationType == MEM_RESERVE) && (fdwProtect == PAGE_NOACCESS)) { lpvResult = HugeVirtualReserve(cbSize, (fdwInternal & MEM_SHAREDONLY) ? ME
All greek to me. And whether it works in practice is another thing.
 Signature 40th Floor - Software @ http://40th.com/ GT40 encryption-database toolkit for Win32 and Linux Download today for vc6, vb6, vc7, evc & gcc
"Susan Loh [MS]" - 18 Sep 2003 17:41 GMT hel@40th.com: You are in violation of your shared source agreement; you are NOT allowed to redistribute Windows CE source code. Please re-read the terms of the agreement you accepted when you installed the source code.
Now, getting back to the real question, you should be able to allocate more than 32MB of virtual memory. Things to check are how much memory is available: Try "mi" from the shell to find out how many free pages there are. Try GetSystemMemoryDivision, it doesn't tell you how much program memory is actually used, but if your object store was consuming more memory than you expected then that might explain it. Try allocating in smaller increments (say 4MB) to see if your VM has become too fragmented to allocate 16MB chunks.
Good luck,
Sue sloh@microsoft.com (remove "online" from reply-to address) _____________________________________________________________ This posting is provided "AS IS" with no warranties, and confers no rights. _____________________________________________________________ Windows Embedded FAQ (http://www.microsoft.com/windows/embedded/faq/default.asp)
Steve Maillet \(eMVP\) - 18 Sep 2003 20:51 GMT Umm, huh? How is he in violation of the agreement? The shared source code allows discussions of the code and possible changes and investigation of behavior. From the agreement: "You can use this Software for any noncommercial purpose, including distributing derivatives. " That leaves it pretty wide open until you sell a device.
 Signature Steve Maillet (eMVP) Entelechy Consulting smaillet_AT_EntelechyConsulting_DOT_com
SM [Thu, 18 Sep 2003 15:51:02 -0400]:
>Umm, huh? How is he in violation of the agreement? The shared source code >allows discussions of the code and possible changes and investigation of >behavior. From the agreement: "You can use this Software for any >noncommercial purpose, including distributing derivatives. " That leaves it >pretty wide open until you sell a device.
>Susan Loh [MS] (sloh@online.microsoft.com)[Thu, 18 Sep 2003 16:41:45 GMT]: >>hel@40th.com: You are in violation of your shared source agreement; you are >>NOT allowed to redistribute Windows CE source code. Please re-read the >>terms of the agreement you accepted when you installed the source code. What he said. If you think either of us is laughing too hard, don't fret, sloh@microsoft.com. Few MSFTies know the first thing about MSFT license agreements and no one blames you for not reading and understanding this one. I've noticed that your online input has degraded these past few weeks (quite a few mistakes). Is everything okay there? Go ahead, let it out.
 Signature 40th Floor - Software @ http://40th.com/ GT40 encryption-database toolkit
"Susan Loh [MS]" - 19 Sep 2003 23:11 GMT Shared Source Agreement for Windows CE .NET: http://go.microsoft.com/fwlink/?LinkId=3223
3. That if you distribute the Software (for noncommercial purposes) in source code form you do so only under this License (i.e. you must include a complete copy of this License with your distribution), and if you distribute the Software solely in object form you only do so under a license that complies with this License.
I'm sorry if you think I am messing up a lot. I'm human. If you guys prefer, I'll just stop trying to help people.
Sue sloh@microsoft.com (remove "online" from reply-to address) _____________________________________________________________ This posting is provided "AS IS" with no warranties, and confers no rights. _____________________________________________________________ Windows Embedded FAQ (http://www.microsoft.com/windows/embedded/faq/default.asp)
Dean Ramsier - 22 Sep 2003 15:12 GMT Not so, not so. Please stick around!!
 Signature Dean Ramsier - eMVP Accelent Systems http://www.accelent.com
> Shared Source Agreement for Windows CE .NET: > http://go.microsoft.com/fwlink/?LinkId=3223 [quoted text clipped - 15 lines] > Windows Embedded FAQ > (http://www.microsoft.com/windows/embedded/faq/default.asp) Bruce Eitman \(eMVP\) - 23 Sep 2003 15:19 GMT I agree! Your assistance has been valuable to many users of this newsgroup.
Please don't take one poster's comments to be from "you guys."
-- Bruce Eitman (eMVP) Senior Engineer Accelent Systems Inc. www.accelent.com
>Susan Loh [MS] (sloh@online.microsoft.com)[Thu, 18 Sep 2003 16:41:45 GMT]: >>hel@40th.com: You are in violation of your shared source agreement; you are >>NOT allowed to redistribute Windows CE source code. Please re-read the >>terms of the agreement you accepted when you installed the source code. Look up Fair Use. I used an excerpt, and if you have a problem with this (see bottom) I suggest you release The Lawyers after you familiarize yourself with this
http://www4.law.cornell.edu/uscode/17/107.html
Susan Loh [MS] (sloh@online.microsoft.com)[Fri, 19 Sep 2003 22:11:55 GMT]:
>3. That if you distribute the Software (for noncommercial purposes) in >source code form you do so only under this License (i.e. you must include a >complete copy of this License with your distribution), and if you >distribute the Software solely in object form you only do so under a >license that complies with this License. Any reasonable person would realize that this does not apply to four lines of source code. And if it specifically said "this software or any part", there's Fair Use.
What exactly in this got your panties in a bunch? It's exactly what he needed, if he knew what he was looking at. This was the last post in the thread, until you offered something up a month later (which started with the uncalled for and useless finger-pointing at the top -- picture the Donald Sutherland version of Invasion of the Body Snatchers, at the end -- you pointing your finger at me and letting out an [eeee]).
>From: hel@40th.com () >Date: Wed Aug 20 12:18:18 2003 [quoted text clipped - 24 lines] > >All greek to me. And whether it works in practice is another thing. For some reason, I only see your posts second-hand.
 Signature 40th Floor - Software @ http://40th.com/ GT40 encryption-database toolkit
Paul G. Tobey [eMVP] - 22 Sep 2003 19:12 GMT Fair Use protects you (you hope), from being prosecuted for copyright violations. It has *nothing* to do with a violation of the license agreement that you are in with MS...
Paul T.
> >Susan Loh [MS] (sloh@online.microsoft.com)[Thu, 18 Sep 2003 16:41:45 GMT]: > >>hel@40th.com: You are in violation of your shared source agreement; you are [quoted text clipped - 55 lines] > > For some reason, I only see your posts second-hand. PT [Mon, 22 Sep 2003 11:12:56 -0700]:
>Fair Use protects you (you hope), from being prosecuted for copyright >violations. It has *nothing* to do with a violation of the license >agreement that you are in with MS... Do you have anything to support you assertion? Anything at all? The agreement has to be backed by something, and it's not a secret (anyone can download it, matter of fact, I could store the entire thing on my website and let anyone read it from my pages) and so all the agreement can do is protect its copyright. I have already shown that I am perfectly in my right to do what I did. Only sloh knows why she did what she did, and I can bet it's pretty selfish.
On the real matter, exactly what do you think the purpose of this "shared source" is, to be cubby-holed in the backroom with "see, we do linux stuff, too -- but don't use it, don't even look at it"?
haha
LICENSE AGREEMENT
1) By reading this you agree to not reply, except to proclaim how wonderful I am
2) You are bound by the terms in this agreement
3) You will send me $100 with each reply to this, or to any related posting
You already read this, so you already agree. It's the law!
 Signature 40th Floor - Software @ http://40th.com/ GT40 encryption-database toolkit
Paul G. Tobey [eMVP] - 23 Sep 2003 18:03 GMT My assertion that you have an agreement or my assertion that Fair Use doesn't have anything to do with a private agreement that you may have with someone?
There's no legal need for any agreement to back up a copyright. All MS has to do is assert in some manner on the code, the packaging, or whatever that they hold the copyright. You are entitled to fair use of that material, assuming that you came into possession of it legally, such as the excerpting that you did, etc. If there is another license agreement in effect, however, *that* may give both of your additional rights and may specify responsibilities, also. Whether the agreement is defensible by MS against you, because of the method they may have used to gain or verify your agreement, is up to the court. Maybe you're right and they can't enforce it, but it is there and fair use has nothing to do with it.
I'm not sure what your problem with Susan is, but I don't see any cause in anything that she's said on this thread for you to have a problem. Certainly, it's not productive to chase people from MS who support us in our efforts to get our jobs done out of the newsgroups.
As far as attaching some type of "if you read this, I own you, nah, nah, nah" to your message, there's no contract created unless 'consideration' changes hands. Since your little message obviously has no value, it's not an enforceable contract.
Paul T.
> PT [Mon, 22 Sep 2003 11:12:56 -0700]: > >Fair Use protects you (you hope), from being prosecuted for copyright [quoted text clipped - 26 lines] > > You already read this, so you already agree. It's the law! PT [Tue, 23 Sep 2003 10:03:36 -0700]:
>My assertion that you have an agreement or my assertion that Fair Use Like I requested, do you have anything to support your assertion? I didn't think so.
>nah" to your message, there's no contract created unless 'consideration' >changes hands. Since your little message obviously has no value, it's not Sure there is, my copyrighted text. I consider it valuable. You are in violation of the LICENSE AGREEMENT to which you obviously agreed, but here you are claiming you don't have to abide by it. Funny how you think you get to choose.
And that's still not the point. The point is, yes, I can post those 4 lines of source code. Do you REALLY have a problem with that? haha
 Signature 40th Floor - Software @ http://40th.com/ GT40 encryption-database toolkit
Paul G. Tobey [eMVP] - 23 Sep 2003 18:28 GMT You need to be more specific about what assertion it is you are talking about. I've asserted that, although you are entitled to fair use for a copyrighted work, that may not be the only legally binding instrument in effect. Whether you can distribute the source, build derivative works, etc. is controlled by any legal agreement that you may have with MS. If you have an agreement with MS that says that you may not do those things and you do, then you are likely in breach of that contract. It may specify that remedies that MS is entitled to, etc. If you want me to justify contract law, that's going to be a longer discourse. Pick up a business law book at the library...
*I* don't have any problem with you posting source code. I didn't call you out about that at all. If MS wants to take issue with it, that's their business. Your assertion that fair use means that anything you have obtained can be published, distributed, etc. in any way you see fit is just false.
Although you never asserted a copyright on your text, I'll leave it out of this message in the interest of good sportsmanship.
Paul T.
Yeah, I do, but I want my $200 first, then we can talk. You are in violation of the LICENSE AGREEMENT to which you obviously agreed.
PT [Tue, 23 Sep 2003 10:28:40 -0700]:
>You need to be more specific about what assertion it is you are talking
>Although you never asserted a copyright on your text Unforuntately for you, it's implied.
http://www.tedi.net/copyright.html
If you can accept tedi. Where's my $200...
 Signature 40th Floor - Software @ http://40th.com/ GT40 encryption-database toolkit
Paul G. Tobey [eMVP] - 23 Sep 2003 19:03 GMT I'm afraid that you'll have to take legal action if you want to recover anything from me for copyright violations. I don't like your chances. As I said, the 'license agreement', because no consideration was exchanged, is invalid.
Paul T.
"Susan Loh [MS]" - 23 Sep 2003 18:57 GMT I do not wish to speculate on whether fair use cancels out the more restrictive terms you agreed to when you licensed the Windows CE source code from Microsoft. However I continue to warn you that the you should carefully review the legal implications of posting that source code publicly and make sure you do not violate the license.
Sue sloh@microsoft.com (remove "online" from reply-to address) _____________________________________________________________ This posting is provided "AS IS" with no warranties, and confers no rights. _____________________________________________________________ Windows Embedded FAQ (http://www.microsoft.com/windows/embedded/faq/default.asp)
Susan Loh [MS] (sloh@online.microsoft.com)[Tue, 23 Sep 2003 17:57:46 GMT]:
>I do not wish to speculate on whether fair use cancels out the more >restrictive terms you agreed to when you licensed the Windows CE source You don't need to speculate if you want to base your assertion on this, you just need to understand what it says (as someone originally pointed you to), and where:
Part I You can use this Software for any non-commercial purpose, including distributing derivatives. Running your business operations would not be considered non-commercial.
[period]
Part II For commercial purposes, you can reference this software solely to assist in developing and testing your own software and hardware for the Windows CE platform. You may not distribute this software in source or object form for commercial purposes under any circumstances.
In return, we simply require that you agree: 1. Not to remove any copyright notices from the Software.
2. That if you distribute the Software in source code form you do so only under this License (i.e. you must include a complete copy of this License with your distribution), and if you distribute the Software solely in object form you only do so under any license that complies with this License.
Whatever you motive was sloh, get a life, really. It's ridiculous. I see source posted from this all the time. The reason? Because it's stupid to dance around it -- and, by the way, all of a sudden -- just because someone without a real clue makes a ridiculous assertion out of the blue.
As to the brown noses in the crowd, eeeuuu (haha). Stupid is one thing, but stupid, spineless, and sporting a (heavy) brown nose is something else.
 Signature 40th Floor - Software @ http://40th.com/ GT40 encryption-database toolkit
Steve - 26 Sep 2003 06:45 GMT I wonder who needs a life...
> Whatever you motive was sloh, get a life, really. It's ridiculous. I Ten - 26 Sep 2003 15:13 GMT Hi,
Since I have been researching the MS licensing agreements and I am actively awaiting a response from MS with respect to distributing modified source code (a derivative) for a CE.NET 4.2 based device, I would like to add what I have learned to this discussion.
The quote that 40th has provided in his/her last post was taken directly from this web site. See
http://www.microsoft.com/windows/embedded/ce.net/evaluation/sharedsource/eula.asp
The fact that it states that the source can't be "distributed for *commercial* purposes under any cirucmstance" says it all. Note that Microsoft specifically qualifies the sentence with "commercial".
Are we here distributing source code for commercial purposes? No, we are not. No one here is selling code snippets.
The fact that the code snippet was used as a reference in an open forum is only questionable because the licensing agreement cleary states that if source is distributed for non-commercial use (which it was), the license agreement must be distributed with it.
So, the only question is whether or not the license agreement was included with the original post. I did not see the original post so I don't know. If not, did this violate the agreement? Yes it did.
However, in my opinion, it does not violate the agreement to a degree that will cause MS financial hardship or loss of IP, which is what the licensing is there to protect. Further, since 99.99 % of the readers of this forum have accepted the agreement when they installed the development tools, does it really matter if it was not included?
Nick.
<hel@40th.com> wrote in message news:ukixmy5gDHA.2400@TK2MSFTNGP11.phx.gbl...
> Susan Loh [MS] (sloh@online.microsoft.com)[Tue, 23 Sep 2003 17:57:46 GMT]: > >I do not wish to speculate on whether fair use cancels out the more [quoted text clipped - 35 lines] > As to the brown noses in the crowd, eeeuuu (haha). Stupid is one thing, > but stupid, spineless, and sporting a (heavy) brown nose is something else.
> I wonder who needs a life... > > > Whatever you motive was sloh, get a life, really. It's ridiculous. I
|
|
|