<commit_before>/* Copyright (C) 2005-2011 <NAME> */

/**
 * JavaAppLauncher: a simple Java application launcher for Windows.
 * JavaParamBlock.cpp
 *
 * <NAME> [<EMAIL>]
 */

// standard
#include <cstring>

// windows
#include <windows.h>
#include <winbase.h>
#include <winreg.h>                     /* for Registry functions */

// local
#include "JavaParamBlock.h"
#include "UI.h"

using namespace std;

/**
 * If there is no previously set user preference for the maximum amount of
 * memory to use, then this is the percentage of the physical memory that
 * should be used.
 */
float const DefaultMaxMemoryPercentage = 0.3;

/**
 * Insist on at least this much RAM.
 */
int const   JavaMinMemoryInMB = 256;

/**
 * Limit the JVM heap size because we now use non-heap memory for things like
 * tile caches.
 */
int const   JavaMaxMemoryInMB = 1536;

/**
 * Copy a C string to a newly allocated C buffer.
 */
static void new_strcpy( char **dest, char const *src ) {
    if ( src ) {
        *dest = new char[ ::strlen( src ) + 1 ];
        if ( !*dest )
            LC_die( TEXT("Could not allocate memory.") );
        ::strcpy( *dest, src );
    } else {
        *dest = new char[1];
        if ( !*dest )<commit_msg>Windows - Different max heap sizes for 32 and 64-bit OS<commit_after>/* Copyright (C) 2005-2011 <NAME> */

/**
 * JavaAppLauncher: a simple Java application launcher for Windows.
 * JavaParamBlock.cpp
 *
 * <NAME> [<EMAIL>]
 */

// standard
#include <cstring>

// windows
#include <windows.h>
#include <winbase.h>
#include <winreg.h>                     /* for Registry functions */

// local
#include "JavaParamBlock.h"
#include "UI.h"

using namespace std;

/**
 * If there is no previously set user preference for the maximum amount of
 * memory to use, then this is the percentage of the physical memory that
 * should be used.
 */
float const DefaultMaxMemoryPercentage = 0.3;

/**
 * Insist on at least this much RAM.
 */
int const   JavaMinMemoryInMB = 256;

/**
 * Limit the JVM heap size because we now use non-heap memory for things like
 * tile caches.
 */
#if _WIN64 || __amd64__
int const   JavaMaxMemoryInMB = 4096;
#else
int const   JavaMaxMemoryInMB = 1024;
#endif

/**
 * Copy a C string to a newly allocated C buffer.
 */
static void new_strcpy( char **dest, char const *src ) {
    if ( src ) {
        *dest = new char[ ::strlen( src ) + 1 ];
        if ( !*dest )
            LC_die( TEXT("Could not allocate memory.") );
        ::strcpy( *dest, src );
    } else {
        *dest = new char[1];
        if ( !*dest )
{'fraction_non_alphanumeric': 0.12387651426338414, 'fraction_numerical': 0.019538882375928098, 'mean_word_length': 2.6887608069164264, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5101761', 'n_tokens_mistral': 844, 'n_tokens_neox': 793, 'n_words': 304}