A C ++ project conflicts with problem of memory fragmentation, and tried the following:
-
Did not pass the Nedmalloc-tension test (crashed after 15 hours), it means that it works in most cases, but not all. And more memory usage than other recurrences.
-
Is not jemalloc-ready for Windows?
-
Compiled with hosted code with tcmalloc-fixed linking, but conflict with CRT symbols do I just create my own cover for allocation TC_molkoc (... ) I can use the nickname? How to do this?
Any comments? thank you in advanced.
Set your project to use the Windows Low Fragmentation Heap (LFH) You can fix your problem without doing more on custom implementation.
Sample code taken directly from MSDN:
#include & lt; Windows.h & gt; # Include & lt; Tchar.h & gt; # Include & lt; Stdio.h & gt; #define HEAP_LFH 2 int __cdecl _tmain () {BOOL bResult; Handle Hahap; ULong Hep Information; // // Note: The heapset information function is available with SP4 on Windows 2000 / only if Hotfix KB 816542 is installed. To run this example on Windows 2000, // if available, use GetProcAddress to get a pointer in the function. // // // Enable Hap End-On-Corruption // A correct application, even if this call may fail, it may still continue, // Therefore it is safe to ignore the return value and Call the function as follows: // (zero) heapset information (zero, hyperbolicTerminationon Corporation, tap, 0); // If the app has to be stack-off-corruption enabled, then // check the return value and exit on the failure shown in this example. // bResult = HeapSetInformation (NULL, HippableTermissionon Correction, Faucet, 0); If (bResult! = FALSE) {_tprintf (TEXT ("Hap End-On-Corruption Has Enabled. \ N")); } And {_tprintf (TEXT ("Last Interval.%. \ N") failed to enable hep end port, GetLastError ()); Return 1; } // // Create a new pile with the default parameters. // hHeap = hepcat (0, 0, 0); If (hHeap == NULL) {_tprintf (TEXT ("final ARO% D. \ N") fails to create a new pile, getLastError ()); Return 1; } // // Enable Low-Frammation Heap (LFH) starting with Windows Vista, // LFH is enabled by default but this call does not make any error // HepInformation = HEAP_LFH; BResult = HeapSetInformation (hHap, HeapCompatibilityInformation, and HeapInformation, sizeof (HeapInformation)); If (bResult! = FALSE) {_tprintf (TEXT ("Low fragmentation pile has been enabled. \ N")); } Else failed to enable a low-fragmentation heap with {_tprintf (TEXT ("last ERO +% D. \ N"), GetLastError ()); Return 1; } Return 0; }
Comments
Post a Comment