cancel
Showing results for 
Search instead for 
Did you mean: 

til function problem

skuvvv
New Contributor
Hello all,
I am curious about usage simple functions such as til.
1)type til 10
returns 7h instead 6h
I run at win x64
2)using `int$ till 10 requires 3x times more memory than simple filling by integer values 
(4 byte for int instead 8byte for long + 4 byte for conversion)
3)I got wsfull with 
aa: til 150000000

ps I just want fast fill big array by integer values(not by longs) and reach 300-400mil of values
5 REPLIES 5

skuvvv
New Contributor
Additional thing that can be a reason of wsfull,
when I fill array, kdb allots memory by steps and not by necessary amount, 
for example additional 10mil of integers will allocate 500Mb of memory, and next step with 270mil+ will get wsfull:

q)\ts aa: 130000000?1000i
634 536871120
q
)aa: null
q
).Q.gc[]
536870912
q
)\ts aa: 140000000?1000i
682 1073742032

buddy memory system
http://www.timestored.com/kdb-guides/memory-management

LamHinYan
New Contributor


LamHinYan
New Contributor
The default integer type is 64 bit long on both kdb32bit and kdb64bit. http://code.kx.com/wiki/Releases/ChangesIn3.0

LamHinYan
New Contributor
http://kx.com/q/d/kdb+.htm
22 Limits

Each database runs in memory and/or disk map-on-demand -- possibly partitioned. There is no limit on the size of a partitioned database but on 32-bit systems the main memory OLTP portion of a database is limited to about 1GB of raw data, i.e. 1/4 of the address space. The raw data of a main memory 64bit process should be limited to about 1/2 of available RAM.


260 million int32 takes 991 MB
300 million int32 gives a wsfull

list1m:`int$til 1000*1000;
bigList:();
a:0i;
do[260;
  bigList,:list1m+a*1000000i;
  a+:1i];