Reputation: 87
I am curious whether the mappedbytebuffer occupies direct memory in Java? As mentiond in here
A direct byte buffer may also be created by mapping a region of a file directly into memory
When I map a file into memory, the direct memory should be used. But I started a program with JVM param "-XX:MaxDirectMemorySize=200MB" then I tried to map a file of 1GB into memory, it worked. What's more, I allocated a directByteBuffer with 200MB first and then tried to map the file of 1GB into memory, and it still worked! So, which part of the memory does mappedbytebuffer occupy?
Upvotes: 1
Views: 534
Reputation: 11
i think,when you map a bigger file into small memory, the instance of mappedbytebuffer
may mapping a region of a file which you have just used
into memory ,then the other region which have been map in memory will exchange into SWAP(the virtual memory on hard disk ) by MMU
Upvotes: 1