Size of dynamically allocated array

What's the easiest way to determine the size (number of objects) of a
dynamically allocated array?

Chip


0
9/26/2003 4:04:57 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
490 Views

Similar Articles

[PageSpeed] 51

While it's probably not reliable, I did find that the address you get back
from the 'new' operator is not the actual starting address of the allocated
block.  If you subtract sizeof(DWORD)*4 from that address and then read the
value at that address, you'll have the requested size, but not the actual
size that the memory manager allocated.  For example:

char *p = new char[1234];
strcpy(p, "Hello World!"); // not necessary but does help to locate stuff in
memory!
char *a = p - (sizeof(DWORD) * 4);
DWORD dwVal = *a; // should be 1234

In this example, the actual size of the block was 1304 bytes.

"Chip Pulitzer" <swpulitzeriii@yahoo.com> wrote in message
news:JsZcb.4101$iT4.2997741@news1.news.adelphia.net...
> What's the easiest way to determine the size (number of objects) of a
> dynamically allocated array?
>
> Chip
>
>


0
david.crow (132)
9/26/2003 8:21:58 PM
Reply:

Similar Artilces:

Dynamic Ranges
Hello, I need to develop a function which uses a range. The range is dynamic based upon a Lease Term. Example: I have a 5 year lease - The range will encompase 5 cells (A1:E1). I will always know the starting Cell. Any help would be much appreciated. thanks ACase Not sure i understand the question - what do you want to know? do you want to know how to develop a function that uses a range - if so, any particular function do you want to know how to create a dynamic range - if so, check out dynamic ranges at www.contextures.com/tiptech.html Cheers JulieD "ACase" <A...

"Chart sizes with window frame" automatically re-checked
Hi, I have chart sheets in Excel 2000. I have unchecked "Chart sizes with window frame" in the Options menu and set zoom on the chart sheets to 100%. My VB program opens the Excel file and updates the cells in the chart's data series. When run from my Windows 2000 PC, everything is fine. When run from our Windows 2003 server, everything is fine. When run as a scheduled task on the Windows 2003 server, the "Chart sizes with window frame" gets checked and the graphs are zoomed to 139%. The charts have been pasted into Powerpoint 2000 as links, and this messes up th...

How to keep MDI window size while cascading?
My application sets all MDI child windows to new size while cascading. What can I do to keep their sizes? ...

malibox size warning message multiple times
the "Your mailbox has exceeded one or more size limits set by your administrator" message is being sent to users once an hour instead of once a day. where is the setting to change this?? thanks Rich, Depending on the version of Exhange: 5.5 - Properties of the Private Information Store container. Limits tab. 2000/2003 - Properties of the Maibox Store that owns the mailbox in question. Limits tab. Hope that helps...MMS -- Malvin M. Seale, MCSE, MCSA Microsoft Product Support Services (Exchange) malvins@online.microsoft.com * Please do not send email directly to this alias....

Array Formula isn't summing but counting
I need to sum information based on several other criteria -- accoun number, sort codes, company names. The array formul {=SUM(A1:F25="A")*(E1:E25>0))} returns a count rather than a sum Does anyone know of a way get it to add my data rather than countin how many? Staci -- Message posted from http://www.ExcelForum.com Hi if you want to sum column E try the array formula =SUM((A1:F25="A")*(E1:E25>0)*(E1:E25)) or a non array formula =SUMPRODUCT((A1:F25="A")*(E1:E25>0),E1:E25) -- Regards Frank Kabel Frankfurt, Germany > I need to sum information ...

Dynamics GP 9.0
When you install Dynamics GP 9.0 from the CD, in the Insallation Type window you will see Server Option or Client Option. The first option should technically say "Server & Client", not just Server. Needless to say, when you Install Server, it installs Client as well. Thanks Girish ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft...

Adjusting toolbar size, restore toolbar
I use MSN stock quote add-in. This has a toolbar w/ several buttons on it. However, I did something the other day and now I can not view all the buttons. And I can not adjust the width by "dragging". How can I restore the toolbar or adjust the width. I also unistalled and reinstalled the add-in, but it did not help Thank you! Try View > Toolbars > Customize "Josh M" wrote: > I use MSN stock quote add-in. This has a toolbar w/ several buttons on it. > However, I did something the other day and now I can not view all the > buttons. And I can n...

RE: Error when initializing Dynamics DB in 6.0
Hello: A colleague of mine is having some issues with installing and upgrading from 6.0 to 9.0. Obivously, 6.0 is no longer supported so I thought that I would post her e-mail here. Below is her e-mail. Any help would be appreciated: I’m doing a 6.0 to 9.0 upgrade, and moving servers. I have loaded 6.0 on the new machine, and am trying to create the DYNAMICS db. I get the message below when I try to create it: It seems to point to the tempdb not being big enough. I have increased the db & log size to > 200MB (docs say Dynamics needs 50). GP is of no help, b/c they do not ...

Reduce Database Size
3 x Exchange 2003 Ent, Windows 2003 I know this gets discussed quite a bit but as our system (and skills) are relatively new I look for your experience and support. After our migration from GroupWise to Exchange our storage groups became quite large averaging 120G each We have now introduced an archiving product which has successfully siphoned off about 120Gb across all three databases. Now things have levelled I would like to reduce the size of the databases. What is the correct and safest method to do this? On Tue, 7 Feb 2006 14:56:53 -0000, "Dave Lee" <abuse@aol.com&...

Delay on update the mailbox size, OWA event slower on update?
Hi...there is a single win2k3 domain and single Ex2k3 environment, a user reported his mailbox is run out of size, we increated the size a lot. But we wait for another hour, it is still complaining not enough space to send message. Check the System Manager again, the size is way under the limit. How to force the system to update the mailbox size right away when it is increased? Would OWA take longer to update the size? how to force OWA to update as well? Thanks, fshguo. I don't think OWA would be any different. Try this: http://support.microsoft.com/default.aspx?scid=kb;[ln];327378...

Message size restrictions
Is it possible to set a limit on the maximum size a message can be that is being sent between 2 users on the same server in Ex 2003? I know you can set limits on the smtp server for messages that go out to the internet but I would like to set a similiar limit on messages that go from one Exchange user to another. Thanks. Bill Unfortunately this is not configurable as you desire. You can set a message size for all users, but not for just specific users. Bob "Bill Uyer" <buyer@dhblattner.com> wrote in message news:%23j%23MaVALFHA.3184@TK2MSFTNGP09.phx.gbl... > Is it po...

How do I add LEFT to this array?
=SUMPRODUCT(--(ISERROR(SEARCH("Account Request",'Incident Data'!$E$2:$E$5000))=FALSE),--(MONTH('Incident Data'!$G$2:$G$5000)=MONTH(C$8))) I want to modify it to restrict where it looks for "Account Request". I figure add LEFT('Incident Data'!$E$2:$E$5000,15) however that returns an error. I also tried putting LEFT after SEARCH. I am still very new to SUMPRoduct and I had help coming up with the formula above; which works perfectly now. I am also reading through: http://www.xldynamic.com/source/xld.SUMPRODUCT.html I don't want to break my ...

Form sizing issue
In my database I have one form with a running list of students. When you select a name from the list, I want it to open the students form to that student's record as a dialog form so that I can have some code wait for the student form to close before it runs. The code is DoCmd.OpenForm "frmStudents", acNormal, , "StudentID = Forms!frmStudents.StudentID", acFormEdit, acDialog All that works fine except that when the Student form opens, it maximizes, removes the toolbars at the top and even covers the Windows start bar at the bottom of the screen. I have played w...

Exchange 2003 SP2 db size limits
I have an Exchange 2003 install that was upgraded to SP2 some months ago. It was my understanding the SP2 raised the db size limit to 75Gb, but I recently had the following error: Product: Exchange Event ID: 1216 Source: MSExchangeIS Mailbox Store Version: 6.5.6940.0 Component: Microsoft Exchange Information Store Message: The Exchange store 'THA\Mailbox Store (SRV_1)' is limited to 18 GB. The current physical size of this database (the .edb file and the .stm file) is 17 GB. If the physical size of this database minus its logical free space exceeds the limit of 18 GB, the da...

552 Requested mail action aborted: exceeded storage allocation #2
A company is getting this error whenever they send email to my domain. I do not have any storage limits set nor am I having problems getting email from anywhere else. Any Ideas. Exchange 2003 sp1 on a 2003 server. In the last exciting episode, "Todd" <anonymous@discussions.microsoft.com> wrote: >A company is getting this error whenever they send email >to my domain. I do not have any storage limits set nor am >I having problems getting email from anywhere else. Any >Ideas. Exchange 2003 sp1 on a 2003 server. Improperly configured secondary Mx record? Hard t...

Resolution & Size output options
When I use Save As on an object and select any of the bitmap formats (bmp, jpg, gif), I am given an Output Options panel. At the bottom of that panel, there are two options: Resolution and Size. Both of them offer the same suboptions: Screen, Printer, Source, and Custom. The Custom suboption also has a pair of dimensions. These dimensions are changed by selecting the Screen, Printer, & Source suboptions, but greyed out. Can someone explain exactly what these options do? I have 2 objects in a Visio document. One was cut-and-pasted from a musical notation program via the clipboard usi...

Matrix/array question
I am trying to demonstrate the effect of changing scores on a cumulative total. My table has 7 categories. Each category has a weight factor of between 1 and 4, and can receive a score between 1 and 5. I want to create a table showing all the possible combinations of scores, to show what effect any change in score in one category will have on the total score. I realize that I will get 78,125 results, but I can then summarize them to show the overall effects. What formula would give me these results, or is there even a way to do it? My categories are a2:a8, weights are b2:b8, and scores ...

Mass Allocate and Fulfill
We use a separate process to allocate and fulfill our sales order batches. We create quite a few different batches each day. Currently, once inventory becomes available, we select each batch one by one and then allocate and fulfill all documents within that batch. Is there a way to select multiple batches and allocate fulfill them all at once? If you're using GP 10.0, try using the new transaction list in Sales to select the documents you want, and then go to the Action Pane and select, "Allocate/Fulfill". "Holt Wrenn" wrote: > We use a separate proces...

Array formulas #2
Hi, I am new to aray formulas and im finding them very handy however i a finding that they slow the spreadsheet up alot and calculations no take some time to run. Is this normal and is there anything i can do/try -- ceem ----------------------------------------------------------------------- ceemo's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1065 View this thread: http://www.excelforum.com/showthread.php?threadid=37395 Yes, that is the drawback of array formulas, here are some info http://www.decisionmodels.com/calcsecrets.htm Regards, Peo Sjoblom &...

Cells increasing in size
How can I keep the cells the original size? When I type anything into them, the cells increase in height. Instead of them being a quarter inch high, they become 2 or 3 inches high. Thanks, John Hi John If you don't have word wrap on then the cells shouldn't change size. If you are using word wrap then Excel will fit the row height to the text unless you have preset the row height After you have set the cells to use word wrap, select the row and go to Format>Row>Height and enter a specific number. Mine is usually 15 This will lock the selected row's height to th...

size of private information store
the private information store is reporting that it is at 16GB. I have done several offline defrags with eseutil /d. The physical size of the .edb and ..stm file remain the same. I have reduced the size of the various mailboxes by ov 5 GB. Any ideas why the size of the .edb file is not reducing accordingly. check your "deleted items retention" window... "Joe McHale" <Joe McHale@discussions.microsoft.com> wrote in message news:07594495-4387-492D-ACDB-B9BD9EB39D6D@microsoft.com... > the private information store is reporting that it is at 16GB. I have done ...

Sizing handles on my chart titles don't work!
I can SEE the sizing handles when I click on the text box, but when I run the mouse over them, I don't get the double-headed arrow. I can't resize the chart title, or either of the axis titles. Strangely, I CAN resize the legend box. I have tried re-making the chart through the Wizard - I've also tried other charts in other files. I can't resize any of the title boxes! Help! Select the chart title and change the font size. "Nicole" <Nicole@discussions.microsoft.com> wrote in message news:F57E90C1-F158-4EBA-8DFB-3E21888CAAA4@microsoft.com... >I can SEE...

Synchronization between Dynamic POS and Office Accounting
I am attempting to Sync as subject and the error generated in Office Accounting states "Item name in Office accounting is already in use in "item description" in POS. All of the inventory items originating in POS is duplicated in Office Accounting. How can I resolve this error? I had this same issue. I deleted the item in MOA and resynched. Everything worked fine after that. Remember if you install SP2 for POS you have to run the Accounting Sync setup again. "Marc" wrote: > I am attempting to Sync as subject and the error generated in Office > Accoun...

array formula problem
Excel array formulas drive me crazy. I think part of my brain formed early under the influence of Fortran (yes I know that dates me). I have two columns of data named 'Date_In' and 'Date_Out. I want to count all of those rows in which 'Date_In' is before a certain date ('Then') and 'Date_Out' as after another date ('Now'). Why doesn't this work? {=Sum(if(and(Date_In<Then,Date_Out>Now),1,0))} Richard Yates What happens when you tried it? Do Date_In and Date_out refer to whole columns (array formulas don't like whole columns). Ar...

Microsoft Dynamics GP should print invoices on the basis actual.
In Great Plains there is a defect which should be resolved soon. That defect is that the sales analysis report and Aged trail balance report are based on the customer master field not on the basis of actual invoices. For example if there was one customer and there are different sales persons providing to the same customer. There is no way you can get the correct figures of sales or aged trial balance on the report on the basis of sales persons. So what would like to see is correct data in future database. ---------------- This post is a suggestion for Microsoft, and Microsoft respo...