Hi chandani, Just one correction.... Please replace all "unsigned short" in my reply as "unsigned int" Actually malloc takes unsigned int a s argumnet. Also to change the unsigned int size, you will have to change something else than just limits .h Please check compiler admin guid. It will help if you let me know which sysetem are you using...and a chunk of program ... If it doesn't violate confidentiality! :-) Cheers, shivendra -----Original Message----- From: Chandani, Chirag [mailto:c10c@rediffmail.com] Sent: Friday, March 14, 2003 9:39 PM To: SHIVENDRA KUMAR Subject: Re: RE: Memory Problem maybe u have diagnosed the problem right are Heap Layers somewhat similar to what u were trying to suggest i will surely try that out and come back if i encounter some other problem regards On Fri, 14 Mar 2003 SHIVENDRA KUMAR wrote : >Hi Vladis & Chandani, > >My 2 cents!... >Let me define the problem first. >Chandani, You are using a system which has unsigned short set to >16 >bits. >So, the maximum value of unsigned short can be just 64k. malloc >takes >unsigned short as argument and obviously maximum you can pass in >, is >64k.So, the maximum size which can alloc'ed is 64k. > >There can be few solutions: >1. There is a limits.h file which defines the max size of various >types. >Please check the "long" size max value. If it corresponds to 32 >bits, >then you can also configure short as the same max size as long. >This >will allow you to malloc more than 64 k in a chunk. >2.If your system still is 16bits, then the other solution is to >write >your own small memory manager on top of malloc >My_malloc( number of multiples, 64k) >This call will allocate 64k chunks using malloc and maintain >pointers to >each block but, will make it appear to the pgm that all blocks >are >contiguous. More details, please check for info about writing a >memory >management layer. >3. Look at pgm requmt . Do you really need one chunk. Or, you can >do >with multiple chunks. May be you can write a wrapper which can >accepts >multiple data blocks of bmp. > >Vladis, to an extent you are right that chandani is using an >older >system, but, that's not the correct explanation of the problem. > > >Regards, >shivendra > >-----Original Message----- > From: Valdis.Kletnieks@vt.edu [mailto:Valdis.Kletnieks@vt.edu] >Sent: Friday, March 14, 2003 7:30 PM >To: Chandani, Chirag >Cc: ietf@ietf.org >Subject: Re: Memory Problem > > >On Fri, 14 Mar 2003 11:33:39 GMT, "Chandani, Chirag" ><c10c@rediffmail.com> said: > > I want to allocate about 600K of memory in a C Program where >i > > load a .Bmp image but Malloc() doesnt allow allocation of >more > > than 64 K > > Is there some way out > >1) Ask on an intro-to-C mailing list. > >2) Learn to give relevant information - are you using some >Microsoft >software, or are you compiling on a BSD 2.11 system on a PDP-11? >What >error does malloc() return? What option(s) did you compile with? >etc >etc? > >3) There's a better-than-even chance that you're compiling on >some >broken system where you have to jump through hoops to get >rational >memory management. If so, your only long-term real hope is to >use >software that actually works. >-- > Valdis Kletnieks > Computer Systems Senior Engineer > Virginia Tech > > _______________________________________________________________________ Odomos - the only mosquito protection outside 4 walls - Click here to know more! http://r.rediff.com/r?http://clients.rediff.com/odomos/Odomos.htm&&odomo s&&wn