Ccall julia ReadOnlyMemoryError()

I am calling a C function from Julia using ccall. When I am running using a small data size it works perfectly but when I am using a huge data size it gives error ReadOnlyMemoryError()

I tried to show a demo of my problem with a easier code below,

Here is a sample of my code,

In C:

struct valueType1 {
    Int32 val1[60];
    Int32 val2[60];
struct valueType2 {
    Int32 val11[60000];
    Int32 val22[60000];
struct valueType1 my_test1(Int32 num_numbers, Int32 *numbers)
    struct valueType1 myt;
    int i;
    for(i=0; i < num_numbers; i++){
        myt.val1[i] = numbers[i];
        myt.val2[i] = numbers[i]; 
    return myt;

struct valueType2 my_test2(Int32 num_numbers, Int32 *numbers)
    struct valueType2 myt;
    int i;
    for(i=0; i < num_numbers; i++){
        myt.val11[i] = numbers[i];
        myt.val22[i] = numbers[i]; 
    return myt;

The code is compiled to a dll file names, testC.dll

In Julia:

struct type1

struct type2

num_numbers= Int16(60)
number = ones(Int16, (60,1))*Int16(300)

x1=ccall((:my_test1,"testC.dll"),type1,(Int, Ptr{Int16}), num_numbers, pointer(number))

num_numbers2= Int32(60000)
number2 = ones(Int32, (60000,1))*Int16(300)

x2=ccall((:my_test2,"testC.dll"),type2,(Int, Ptr{Int16}), num_numbers2, pointer(number2))

when I am using my_test1, I get my result as it should. But with my_test2 I get the

Anyone have went through similar problem before? Or have any idea how to solve it.