Frequently Asked Questions

Releasing Document instance may take longer

On some memory condition, especially on multithreading code, loading many pages causes much fragmentation of memory blocks due to its frequent use of small memory blocks and it makes the delete calls so slow.
You can ease the condition by using Chunk::compact method. The method linearize the memory use of the Chunk instance.

On Windows XP or later, there's a mechanism to improve such situation, named low-fragmentation heap. You can enable this by the following code:

#if _MSC_VER >= 1400
  typedef BOOL (WINAPI *fp_HeapSetInfo)(
    HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T);
  fp_HeapSetInfo hsi = (fp_HeapSetInfo)GetProcAddress(
    GetModuleHandle(_T("Kernel32")), "HeapSetInformation");
  if(hsi)
  {
    ULONG flags = 2;
    HANDLE hHeap = (HANDLE)_get_heap_handle();
    if(hsi(hHeap, HeapCompatibilityInformation, &flags, sizeof(flags)))
    {
      // MessageBox(NULL, _T("Wow, LFH is enabled!"), _T("Enabling LFH"), MB_OK | MB_ICONINFORMATION | MB_SYSTEMMODAL);
    }
#endif

Please note that _get_heap_handle function was introduced on Visual C++ 8.0 (Visual Studio 2005) so this code block should be ifndef-ed for earlier compilers.

PixelLive SDK Frequently Asked Questions

  1. I've got many linker error when building samples!

    Basically, on Linux machine (but it's also true with future Mac OS X machine), we should explicitly specify the compiler to build the codes by CXX variable like the following commandline:

        make CXX=g++33
    

  2. With Visual Studio .NET, my code (I've simply copy-n-pasted the code on the tutorial) causes runtime exception.

    Please check your compiler settings, without /GR option, you may happen to get such result. For more information, see Windows Development Notes.

  3. String seems to crash when initialized as a global variable.

    In general, global variables are initialized before execution of some initialization codes and also before main(). Since String depends on initialization of some components, it should not be used before them and it could not be a global variable.
    Anyway, if it could not be non-global variable, there is a way to make it fake-global variable:

    String& getMyFakeGlobalVariable()
    {
        static String str;
        return str;
    }
    

This document is automatically generated using doxygen 1.5.4 at Fri Jun 27 18:22:53 2008.