We can do this with a bit of simple math. I'm assuming here that you're on a 
64-bit machine so that pointers and integers are 8 bytes long. A sequence holds 
three things in a smalle stack-allocated object, the "capacity" which is the 
size of the buffer, "length" which is the current amount of elements in the 
buffer and a pointer to the "buffer" itself. This amounts to 24 bytes. The size 
of the buffer depends on how big the sequence is and how big your elements are. 
Since you use `newSeqOfCap` only that number will be allocated. So you allocate 
50 elements. Each element is the same size, and arrays in Nim are static, so 
your elements will be 3x the length of a string. Strings in Nim are essentially 
just a specialised sequence. So they are also 24 bytes big. So each of your 
arrays will take up 3*24=72 bytes, and you have 50 of them so the buffer of the 
sequence will be allocated on the heap as 360 bytes. Since all your strings are 
empty by default they will just hold NULL pointers. So all in all you will use 
24 bytes of stack memory, and 360 bytes of heap memory for that allocation.

Reply via email to