473,320 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

new invokes VirtualAlloc

200 100+
Hello everyone,


On Windows, when we allocate large amount of memory, new will call
VirtualAlloc directly, other than call HeapAlloc then through
HeapAlloc call VirtualAlloc indirectly?

Anyone to clarify this?


thanks in advance,
George
Jan 29 '08 #1
6 2136
weaknessforcats
9,208 Expert Mod 8TB
Has your Windows via C/C++ showed up yet???

VirtualAlloc() is used to allocate memory to your process.

CreateProcessHeap() allows you to creater a heap.

HeapAlloc() allows you to allocate memory from that heap.

The C++ new operator, by default, uses the CRT heap created per the C++ lanaguage specification. When memory is needed it calls HeapAlloc(). If there is insufficient memory it calls VirtualAlloc() to get more memory and then calls HeapAlloc().
Jan 29 '08 #2
George2
200 100+
Thanks weaknessforcats,


--------------------
"it" calls VirtualAlloc() to get more memory and then calls HeapAlloc().
--------------------

It means new?

Has your Windows via C/C++ showed up yet???

VirtualAlloc() is used to allocate memory to your process.

CreateProcessHeap() allows you to creater a heap.

HeapAlloc() allows you to allocate memory from that heap.

The C++ new operator, by default, uses the CRT heap created per the C++ lanaguage specification. When memory is needed it calls HeapAlloc(). If there is insufficient memory it calls VirtualAlloc() to get more memory and then calls HeapAlloc().

regards,
George
Jan 30 '08 #3
weaknessforcats
9,208 Expert Mod 8TB
As far as I know.

You can always read up on this.
Jan 30 '08 #4
George2
200 100+
Sorry for my English understanding weaknessforcats,


Do you mean It means new in post #3?

--------------------
"it" calls VirtualAlloc() to get more memory and then calls HeapAlloc().
--------------------

As far as I know.

You can always read up on this.

regards,
George
Jan 31 '08 #5
weaknessforcats
9,208 Expert Mod 8TB
Yes. the operator new is what this thread is about.
Jan 31 '08 #6
George2
200 100+
Thanks weaknessforcats,


My question is answered. And I think you agree that the final conclusion is new will invoke VirtualAlloc directly when the request size of memory to be allocated is large.

Yes. the operator new is what this thread is about.

regards,
George
Feb 1 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Don Peters | last post by:
I'm relatively new to ASP.NET. I'm running it under Win XP Pro, using Visual Studio 2002.NET (haven't migrated to VS2003 yet). The ASP.NET application I'm having a problem with was initially set...
6
by: Tom | last post by:
Anybody know how to modify this script to return to the HTML page from which it was launched? <script language="javascript"> document.location.href="MailTo:"; </script>
4
by: nosbtr1 | last post by:
When a row gets modified and it invokes a trigger, we would like to be able to update the row that was modified inside the trigger. This is (basically) how we are doing it now: CREATE TRIGGER...
2
by: smurf75 | last post by:
Hi! I'd like for someone to please explain something about p/invoking that i havent managed to find out else where. I believe that following two snippets both are p/invokes? ...
3
by: Stephen Gennard | last post by:
Hello, I having a problem dynamically invoking a static method that takes a reference to a SByte*. If I do it directly it works just fine. Anyone any ideas why? I have include a example...
3
by: ayan4u | last post by:
hi, I am using InvalidataRect(hWnd, &rect, TRUE) to clear my client rect....does this mean that a WM_PAINT message will the invoked automatically by it.... neways fot the time being lets assume...
1
by: RichardOnRails | last post by:
Hi All, I put up a toy webpage to test the use of various javascript functions, etc.: http://home.comcast.net/~CaptQueeg/JavaScriptDemo3.html It has three links: #1 clears a Trace area and...
3
by: George2 | last post by:
Hello everyone, I heard some points that the memory allocated by new does not belongs to virtual memory, and onlymemory allocated by VirtualAlloc belongs to virtual memory. 1. I think...
3
by: jeffliuus | last post by:
Hi everyone, would anyone here can help me answer this question? How can I get the user name that invokes a job within the jobstep script? your help is much appreciated. Thanks, Jeff
1
by: George2 | last post by:
Hello everyone, On Windows, when we allocate large amount of memory, new will call VirtualAlloc directly, other than call HeapAlloc then through HeapAlloc call VirtualAlloc indirectly? ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.