memory

Convert large JSON file to MySQL

I have a ~1MB JSON file that needs to be converted to MySQL. The file has close to 400 records. What is the best way to do this using PHP ? If i try to add 400 records in a single pass, I either get the memory or execution time error. Whats the best way around this ? ...

Force allocating real memory

Is it possible to allocate big chunk (512Mb-1Gb with 4Gb installed) of real memory without dropping it to swap? My final intention is to free system memory: os x has a problem when free memory is near 0 — it doesn't try hard to put unused memory to swap and everything becomes very slow trying to get memory. So, I decided that if some pr...

how to get page size

I was asked this question in an interview Plz tell me the answer :- You have no documentation of the kernel. You only knows that you kernel supports paging. How will you find that page size ? There is no flag or macro you have that can tell you about page size. I was given the hint as you can use Time to get the answer. I still have no...

Get total system memory without external tools

To get total installed RAM I can use popen("sysctl -n hw.memsize", "r"), but is there some library to get this info without running external tools? ...

How to fill memory fast with a `int32_t` value?

Is there a function (SSEx intrinsics is OK) which will fill the memory with a specified int32_t value? For instance, when this value is equal to 0xAABBCC00 the result memory should look like: AABBCC00AABBCC00AABBCC00AABBCC00AABBCC00 AABBCC00AABBCC00AABBCC00AABBCC00AABBCC00 AABBCC00AABBCC00AABBCC00AABBCC00AABBCC00 AABBCC00AABBCC00AABBCC0...

Disposing of Resources in .NET

i have a stupid question, but i want to hear the community here. So here is my code: using (FtpWebResponse response = (FtpWebResponse)request.GetResponse()) { return true; } My question, is it any different than: (FtpWebResponse)request.GetResponse(); return true; Which one is better in general? which one in terms of GC ...

In what situations Static Allocation fares better than Dynamic Allocation?

I was going through some of the decisions made to make Xara Xtreme, an open source SVG graphics application. Their memory management decision was quite intriguing to me since I naively took it for granted that on-demand dynamic allocation as the way of writing object oriented application. The explanation from the documentation is ...

Can RichtTextBox.RecreateHandle called in wrong moment cause Memory Access Exception?

Hi, My app sometimes throw this exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. There is NO WAY how to reproduce it. I would say that chance it happens is around 1 in 500. It always happens at a different time and at a different place (I...

iPhone app crashes when launched from Xcode, but not from iPhone

I have an app that is crashing on the iPhone, but only when it launched via Xcode. I can see in the iPhone console log that the app receives a memory warning, and then there are some strange events like these: Sun Jul 11 00:03:43 Matts-iPhone com.apple.launchd[1] (UIKitApplication:com.mycom.myapp[0x3f60][5591]) <Notice>: (UIKitApplicat...

Where to release an object? dealloc or ViewDidUNload

Hi Friends, When we need to release an object,where to do it, either at the dealloc method or in the ViewDidUnload for a viewController? which would be better? I think that viewDidUnload would do better, because once the view controller is unloaded the objects would be released. And in the dealloc case, from the documentation When...

Calling property's setter method with nil value

Hi Friends, Consider I have a property named sampleObject. In dealloc method, which should be the best way to manage memory? Option 1: self.sampleObject = nil; //This will release the sampleObject and set it to nil This is equivalent to [sampleObject release]; sampleObject = nil; Option 2: Explicitly releasing an object and ...

Manipulating data in Memory instead of file.

consider the function below: int Func(char* filename); int Func(FILE* filepointer); these two do the same, reads alot of data from the given file (by name or pointer), analyze he result, and returns it. I wanna call this function with lots of different data. Therefore I should write data into file, then pass the new filename to Func. ...

SSE Alignment with class

Having some really weird problem and as beginner with c++ I don't know why. struct DeviceSettings { public: ....somevariables DXSize BackbufferSize; ....somemethods }; struct DXPoint; typedef DXPoint DXSize; __declspec(align(16)) struct DXPoint { public: union { struct { int x; int ...

Output _CrtDumpMemoryLeaks() to a String

Hi, Is it possible to output the contents of the memory leak dump to a String (not a console)? Hopefully yes :) _CrtDumpMemoryLeaks(); // to-string? ...

Permanent Memory Address

With my basic knowledge of C++, I've managed to whip together a simple program that reads some data from a program (using ReadProcessMemory) and sends it to my web server every five minutes, so I can see the status of said program while I'm not at home. I found the memory addresses to read from using a program designed to hack games cal...

.NET CF checking RAM physical errors

Is there any common algorithm to check the RAM memory of a device in terms of physical memory access errors? I thought that the simplest way is iteration over the whole memory and writing, reading and comparing each byte. Maybe is there any better way? How to allocate the whole accessible memory in .NET CF? I'm using newly designed Wind...

How to programmatically detect which drive is used for the swap file on Windows?

All, As far as I know in Windows Operating Systems we have Virtual Memory which is stored on the hard disk. Which drive is used for this purpose ? I have a service that uses a lot of memory so I would like to know whether there is enough disk space. Rgds, MK ...

QT APPlication not exiting , Remain in Memory

Hello and Good Morning , I have problem using QT application . I am posting little code here QApplication a(argc, argv); QString path = qApp->applicationDirPath(); qApp->setQuitOnLastWindowClosed(false); a.addLibraryPath(path+"/plugins"); TryQt w; w.show(); return a.exec(); this is how i am starting my Application . In the A...

HashSet of Strings taking up too much memory, suggestions...?

Hello. I am currently storing a list of words (around 120,000) in a HashSet, for the purpose of using as a list to check enetered words against to see if they are spelt correctly, and just returning yes or no. I was wondering if there is a way to do this which takes up less memory. Currently 120,000 words is around 12meg, the actual f...

Maximize program responsiveness

Hi. I have a program that I use as an alt-tab replacement. I wrote it in .NET, so it has a sizable memory footprint. Since I use it only occasionally, it tends to get paged. So when I call it up, it often takes a few seconds to display. This is very annoying. Is there a way to prevent it from being paged so that always comes up immediate...