Showing posts with label cygwin. Show all posts
Showing posts with label cygwin. Show all posts

Is it a Cygwin limitaion ?



Purpose of this link to find/list the method to increase the Virtual memory in cygwin.

Cygwin is handling VM as file system, If host machine allow me to create 4GB file than I should get minimum 4GB VM.

I am not able get this :( I tried a lot and finally I stopped working on that, bec it is impossible :)

I will explain the requirement:

I am running a server on cygwin (on windows 7 , 64 bit , 6 GB RAM ), it used to run fine with Linux environment. Aim of the server is supporting the data access protocol.

When client request for the huge data around one GB from the server it start crashing on cygwin (fine with the linux/windows)
On debugging I found that it is failing at huge memory allocation :
_buf = new char[array_wid]
where array_wid is 1GB. So it is finding difficult to get huge continues memory in cygwin.

In cygwin uses the cygwin1.dll to allocate the memory. Default memory allocation is 384MB. To get the max memory you have set registry entry.

I did that using regtool command,
regtool -i set /HKLM/Software/Cygwin/heap_chunk_in_mb 4096
regtool -i set /HKCU/Software/Cygwin/heap_chunk_in_mb 4096

After this command I am started getting 2GB virtual memory

For more information: http://www.cygwin.com/cygwin-ug-net/setup-maxmem.html

To increase the heap memory I rebuild my solution with
-Wl,--stack,8388608,--large-address-aware,--heap,200000000
.

Still I was getting 2GB VM , I am not able to change that using ulimit –v also

And some link talking about the changing the host machine boot.ini file for extra VM, I tried that as well.

And I am sure that with 32-bit cygwin, I cant achieve this , if any one have 64bit cygwin please share :)

Mounting file system permanently in cygwin



Problem:The “mount” command is built for mounting USB devices and the temporary devices, So it will usable for per user session.
If user logout from the user session, you can’t access that mount drive again.

Work around :
Add the mount command on “.bash_profile” file ( available at you home directory)
.bash_profile will execute every session, It is like permanent mount.
RISK: If user run the mount command second time, get the error message that it is already mounted, because that our script may fail.

Solution: creating soft links (shortcuts) instead of mounting
Ie. As we are using the cygwin , “ln –s” command instead of “mount”
The command is: “ln –s x: /usr/local/share/data”

It solved my problem, let me know if you have any other thought :)