<commit_before>// vld_main.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <windows.h>
#include <malloc.h>

#define VLD_FORCE_ENABLE
#include <vld.h>


class MemoryLeak {
public:
    MemoryLeak(size_t n) { l = malloc(n); memset(l, 0x30 + (n / 10), n); } // 4,5
    ~MemoryLeak() { free(l); }
private:
    void* l;
};

static void* s_m = malloc(10); // 1
static char* s_n = new char[20]; // 2

static MemoryLeak* pml = new MemoryLeak(70); // 3: leaks a new pointer and malloc(70)
#if _MSC_VER > 1700
static MemoryLeak ml{ 80 }; // *should* be freed and not report as a memory leak
#endif

void* g_m = malloc(30); // 6
char* g_n = new char[40]; // 7


int Test()
{
    VLDSetOptions(VLD_OPT_TRACE_INTERNAL_FRAMES | VLD_OPT_SKIP_CRTSTARTUP_LEAKS, 256, 64);

    void* m = malloc(50); // 8
    char* n = new char[60]; // 9

    memset(s_m, '1', 10);<commit_msg>Fix build warning in vld_main for truncation of size_t to int<commit_after>// vld_main.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <windows.h>
#include <malloc.h>

#define VLD_FORCE_ENABLE
#include <vld.h>


class MemoryLeak {
public:
    MemoryLeak(size_t n) { l = malloc(n); memset(l, 0x30 + ((int)n / 10), n); } // 4,5
    ~MemoryLeak() { free(l); }
private:
    void* l;
};

static void* s_m = malloc(10); // 1
static char* s_n = new char[20]; // 2

static MemoryLeak* pml = new MemoryLeak(70); // 3: leaks a new pointer and malloc(70)
#if _MSC_VER > 1700
static MemoryLeak ml{ 80 }; // *should* be freed and not report as a memory leak
#endif

void* g_m = malloc(30); // 6
char* g_n = new char[40]; // 7


int Test()
{
    VLDSetOptions(VLD_OPT_TRACE_INTERNAL_FRAMES | VLD_OPT_SKIP_CRTSTARTUP_LEAKS, 256, 64);

    void* m = malloc(50); // 8
    char* n = new char[60]; // 9

    memset(s_m, '1', 10);
{'fraction_non_alphanumeric': 0.15202156334231806, 'fraction_numerical': 0.04743935309973046, 'mean_word_length': 3.4295942720763724, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '4800625', 'n_tokens_mistral': 819, 'n_tokens_neox': 729, 'n_words': 221}