|
A pool exists to provide management of resources.
If you are not managing the size of your "memory pool" exactly what are you managing?
|
|
|
|
|
The task you're describing is exactly what the system memory manager is built for! It can allocate objects of any size, and will organize your memory in such a way that it can handle millions of calls without serious degradation.
Memory Pools take advantage of the fact that most of the time when you have lots of allocations, you always allocate objects of the same type and size. Based on that assumption, you can improve the performance of the allocation (and deallocation) process, and reduce memory fragmentation.
If you can't make such assumptions, then you'd need to do exactly the same thing the system memory manager does. In other words: just use new and delete.
Is there a specific reason why you think you need a pool? Maybe there are better ways to improve yur program.
|
|
|
|
|
I need to optimize my stream player client, it will play 8 road stream in the same time.
I think that if use the memory pool, it will help to reduce the usage of time about allocate memory.
30 frames every second, but H264 has I Frame P Frame. So different frames have different size. So the memory pool of boost is not suitable for my client system.
|
|
|
|
|
Ok, so the sizes are in fact not freely variable, they may just vary between two (or more) different sizes.
In that case, use two (or more) pools - one for each size.
|
|
|
|
|
Oh my God. If there have one hundred different size, I will create one hundred memory pool?
|
|
|
|
|
I am not familiar with player streams. After your last posting my understanding was that you get Frames of very specific type (I Frame and P Frame, maybe some other frame types). I assumed that since you know these types, you deal with them in your program and of course must know their size (well, your compiler does).
If that is not the case, then what do these types mean, and what is the data type you use for storing?
|
|
|
|
|
I am trying to draw a shape or font on dialog and then fill the outline. I have 2 buttons on this 2 buttons I have the following code
[code]
case IDC_BUTTON1:
MessageBox(hDlg, L"Start Drawing!!", L"ButtonPressed", MB_OK | MB_ICONEXCLAMATION);
hDC = GetDC(hDlg);
brush = CreateSolidBrush(RGB(128, 128, 128));
SelectObject(hDC, brush);
hpen = CreatePen(PS_SOLID, 1, RGB(128, 0, 128));
SelectObject(hDC, hpen);
BeginPath(hDC);
break;
case IDC_BUTTON2:
MessageBox(hDlg, L"End Drawing!!", L"ButtonPressed", MB_OK | MB_ICONEXCLAMATION);
EndPath(hDC);
StrokeAndFillPath(hDC);
DeleteObject(brush);
ReleaseDC(hDlg, hDC);
break;
[/code]
Then in the drawing part I have the following.
[code]
case WM_LBUTTONUP:
if (IsDlgButtonChecked(hDlg, IDC_RADIO1) == BST_CHECKED )
{
EndX = LOWORD(lParam);
EndY = HIWORD(lParam);
SetROP2(hDC, R2_XORPEN);
MoveToEx(hDC, StartX, StartY, NULL);
LineTo(hDC, EndX, EndY);
IsDrawing = FALSE;
}
[/code]
When I remove the BeginPath() and EndPath() functions my lines are being drawn. But when I insert this BeginPath() and EndPath() and StrokeAndFillPath(hDC); the nothing is being drawn.
Why it is not doing as per the expectations. I want to draw a shape for example A with a outline. And i want it to be closed when drawing is ended and filled the hollow portion.
What am I doing wrong in this ? Please help. I am not implementing it in WM_PAINT but drawing is done in WM_LBUTTONUP. Please help. Thanks a lot in advance
|
|
|
|
|
You are probably doing it in the wrong place. All painting should be done in response to a WM_PAINT message. Doing it elsewhere means that it will be overwritten the next time the window gets repainted.
Note: please put your code (properly indented) in between <pre> tags (use the code link above the edit window) so it is like:
if (IsDlgButtonChecked(hDlg, IDC_RADIO1) == BST_CHECKED )
{
EndX = LOWORD(lParam);
EndY = HIWORD(lParam);
SetROP2(hDC, R2_XORPEN);
MoveToEx(hDC, StartX, StartY, NULL);
LineTo(hDC, EndX, EndY);
IsDrawing = FALSE;
}
Use the best guess
|
|
|
|
|
hi , ,
"Use hardware acceleration when available " only exists on latest version of chrome.
I know that we can go to the Chrome menu > Settings > Show advanced settings > "System" > unselect "Use hardware acceleration when available" .
However I don't know path of file or path of registry so I can't change value of "Use hardware acceleration when available "
How to disable "Use hardware acceleration when available" using C++ .
Thanks
ThongLT
|
|
|
|
|
This setting is stored in a file called Local State .
The file is available in the folder C:\Users\<user>\AppData\Local\Google\Chrome\User Data
The contents of this file are in JSON format.
There is a section as follows -
"hardware_acceleration_mode": {
"enabled": true
}
Changing the value between true and false toggles this setting.
Make sure that chrome is not running when changing this value.
|
|
|
|
|
@Superman :thank you for helping me
I will check this way and we can modify value, and then The chrome can run normally .
Thanks
ThongLT
modified 10-Jul-13 4:35am.
|
|
|
|
|
Hi,
I am very new to automation code Unit testing.I feel we can do Unit Testing using Boost Library for MFC code.So i tried for a sample example for its usage. I got a link from a link like - ''Designing Robust Objects with Boost[^] .Here he implimented for a DLL. But my application is a EXE(MDI application)and having lot of dependenies.
Hence i'm looking for more sample which shows Unittesing for EXEs and Mocking activity for the dependency.And all using BOOST C++ library. Now i'm using its latestes version. OR else any suitable TOOL suggested for the same purpose. Kindly help me soon.
|
|
|
|
|
Unit testing is done for code such as C++ classes or functions.
It will be the same for either a DLL or an EXE or however you package your code.
|
|
|
|
|
Thanks Superman for your suggestion.
In my case, as it is a MFC application, there is lot of predefined classes which are being used in my application(MDI). Like - CString , CWinApp, CSerialization, ... etc. So how to handle those predefined class or class's methods.
And some of the Dialog Boxes [Modal Dialog boxe] are there ,for them some input parameteres are there and some values are being returned from that dialog to the mail application. So for this we may have to create some Abstract class and some mocking lines need to handle the dependency. But i unable to implement the same. So i need some example implementation which may be easier to cath easily. Hence kindly help me .
|
|
|
|
|
You will need to stub out the predefined classes and some APIs.
You will also need to create other test harnesses to block out the UIs.
All these will not be very straight forward to implement.
I'm unable to show you code that I have since it is proprietary.
You will need to search the web to see if you can find any examples.
Since I learned them on the job, I'm not sure if there are any books available on this.
|
|
|
|
|
You are absolutely right.
It seems this methodology defintely fulfill my requirement.Since last 2 weeks i'm struggling for the same. Similar type of methodology, some has adviced me also. Unfortunately i unable to contact him.
Also i searched a lot from web,but faild to get any proper guidance. As i'm beginner to this area , iunable catch some of the web documents.
I should not ask like this and also it is hard to find out time.But my kind reqest to you. If possible can you please create a small Dialog based/ SDI/ MDI application and use BOOST library/any good tool for its unit testing. I know,for you it'll take maximum 1- 1.5 Hrs to do.Really i'm feeling bad while asking you to work for me, but i am really in a big trouble.
And i need to show some good progress by tomorow.So that i can give a confidence and i'll be able to implement for whole project .Hence kindly if you can able to prepare some protoype app(above), it'll be kind enough. So that i can able do some progres or it may enhance my confidence on further Unittesting work.Thats what my customer wants. Hence please try to help sooon.
Additianlly i need to look at test coverage activity too.
Thank you
modified 9-Jul-13 0:15am.
|
|
|
|
|
Hi there,
I have been using a CMFCShellTreeCtrl inside an OutlookBar, and simply wanted to change the name label on it. The control itself works just fine. Creation is performed in the following way:
tree.Create(dwTreeStyle, rect, &bar, ID);
pOutlookBar->AddControl(&tree, strName, 2, TRUE, dwStyle);
Simply changing the contents of strName does not result in a change in the labeling of the control. The old name is still present. What is going on here?
many thanks..
|
|
|
|
|
Just a thought, might it be that what's displayed is some other property e.g. data or content?
|
|
|
|
|
The control is ultimately inheriting from CWnd ; have you tried SetWindowText [^]?
Use the best guess
|
|
|
|
|
Thank you both for your suggestions. Ultimately I decided to use a different (simpler) type of control to achieve the functionality I wanted.
Still curious about this simple problem.. I will revisit it another time.
cheers..
|
|
|
|
|
i want to make circular progress bar control on my dialog??
How can operate on this?? Give some tips and idea!
From funcky coder..
|
|
|
|
|
|
Thanks to good tips.. Ill change on MFC Type,,
Maybe big work for me! YAY~
|
|
|
|
|
|