I have a class like this (assume all malloc's succeedes)
class CMyClass
{
public:
CMyClass()
{
lpData = malloc(128);
};
~CMyClass()
{
free(lpData);
};
public:
LPVOID lpData;
};
then I execute this:
CMyClass *lpList = new CMyClass[32768];
delete [] lpList;
The problem is that in x86 the code works fine and fast (some milliseconds to complete in debug and release builds) but in x64 the delete call takes about 15 seconds to free all memory.
O.S. is Win7 x64.
Hints will be appreciated.
Regards, Mauro.
In the search box on the taskbar, type performance, then select Adjust the appearance and performance of Windows in the list of results. On the Visual Effects tab, select Adjust for best performance > Apply. Restart your PC and see if that speeds up your PC. If your PC still runs slowly, continue to the next tip. 7. Pause OneDrive syncing
Tips to improve PC performance in Windows 10. 1 1. Make sure you have the latest updates for Windows and device drivers. 2 2. Restart your PC and open only the apps you need. 3 3. Use ReadyBoost to help improve performance. 4 4. Make sure the system is managing the page file size. 5 5. Check for low disk space and free up space. More items
9. Check for and remove viruses and malware A virus, malware, or malicious software could cause your PC to run slowly. Other symptoms include unexpected pop-up messages, programs that unexpectedly start automatically, or the sound of your hard disk constantly working.
Here are the tips in order of what you should try to fix the problem. To get more information about each tip, use the Tips to improve PC performance link at the bottom of this topic. Check your updates for the latest updates for Windows and device drivers. Restart your PC with only apps you need.
It is possible that if you are running your test app through a debugger that you are hitting some performance issue with the Windows debug heap. Add _NO_DEBUG_HEAP=1
to the environment settings for the debuggee (in the Project Properties->Configuration Properties->Debugging->Environment property under Visual Studio 20xx) and see if that improves your deallocation perf.
I just tested this myself, using gcc 4.6.1-1 on Debian (after adding typedef void *LPVOID
). There is no difference; both execute instantly, even without any optimization turned on.
I upped the array length to 1048576 to get a measurable runtime (0.161s), which was the same for both IA32 and AMD64. I turned on optimizations (-O3), and the time remained the same, but decreased to 0.157s. -Os (optimize for size) had the same result.
Is it possible you used different build options, like maybe you have some sort of memory access debugging enabled on AMD64?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With