Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- memory



  malloc/free and new/delete in C++

malloc and free are C++/C language standard library functions, while new/delete are operator of C++. They can be used to allocate dynamic memory and free memory in C++ programs malloc/free can not meet the requirements of dynamic objects creation. Object needs to call the constructor to initialize the object when creating, the object needs to call the destructor before it is destroyed  Since malloc() and free() are library functions rather than operators, the compiler has no control permiss...

   C++,memory,malloc,free,new,delete     2012-06-20 06:52:09

  UIWebView Secrets - Part1 - Memory Leaks on Xmlhttprequest

My first blog post on iphone subject reveal a big memory bug when using UIWebView component. This is the (only one) component to display some HTML content in an iphone interface. UIWebView object has a lot of differents issues and I’m going to highlight the biggest of them. Actually, all XMLHttpRequests used in javascript code are fully leaking!!! I mean when you do a request that retrieve 100ko of data, your memory used grow up for 100ko! This bug is not always active, but almost always....

   XMLHttpRequest,Memory leak,Mobile device,UIWebView     2011-11-25 13:46:30

  What surprise Google brings us in Nexus 5?

Because Nexus 4 performed well after release, many people are confident of the performance of the upcoming Nexus 5. It is manufactured by LG and equipped with attractive configurations. LG Nexus 5 will have Android 5 installed, as for hardware, it will have a 5.2 inch screen with a resolution of 1920x1080  Also the processor will be a 2.3GHz Quad-Core processor. The exciting part is it has a 4GB(Some says it's 3GB) memory which is larger than almost all current Android devices which have 2G...

   Nexus 5,Google,LG     2013-04-08 07:37:41

  C++ 11 Memory Management

Enterprise development and networking specialist Stephen B. Morris illustrates how to handle a classic C/C++ problem by using the new features in C++ 11 in conjunction with more established techniques.Memory management has always been one of the most error-prone areas of C++. The same is true of C. One of the strengths of managed languages, such as Java and C#, is their support for automatic garbage collection. Garbage collection still isn't a feature of C++ 11, so we must still be caref...

   C++ 11,Memory management,GC,Memory leak     2012-01-10 01:14:59

  Use Memory Analyzer Tool in Eclipse

When developing applications, we often encounter memory issues of an application. To analyze how much memory each class takes, we need to have some specific tools to assist us. One of them is Memory Analyzer Tool on Eclipse. The Eclipse Memory Analyzer is a fast and feature-rich Java heap analyzer that helps you find memory leaks and reduce memory consumption. To use the Memory Analyzer Tool, you first need to install it on Eclipse. You can go to Help -> Install New Software.... Paste  h...

   Memory analyzer tool, Eclipse,heap dump, HPROF     2014-10-28 07:22:35

  Can two new objects point to the same memory address in GoLang?

Do you have any idea what the output will be for below GoLang snippet? package main import ( "fmt" ) type obj struct{} func main() { a := &obj{} fmt.Printf("%p\n", a) c := &obj{} fmt.Printf("%p\n", c) fmt.Println(a == c) } Many people would think that a and c are two different object instances which have different memory addresses. Hence a == c will be false. But if you try to run the above program, you would see below output 0x5781c8 0x5781c8 true To get to know the reason wh...

   GO,GOLANG,VARIABLE ESCAPE,ZEROBASE     2019-04-06 01:19:52

  Google open sources Leak Finder for JavaScript

Google recently open sourced a tools for finding memory leaks in JavaScript programs. In JavaScript you cannot have "memory leaks" in the traditional sense, but you can have objects which are unintentionally kept alive and which in turn keep alive other objects, e.g., large parts of DOM. Leak Finder for JavaScript works against the Developer tools remote inspecting protocol of Chrome, retrieves heap snapshots, and detects objects which are "memory leaks" according to a given leak definition. The...

   Google,Open source,JavaScript     2012-08-15 13:45:34

  Bug caused by using changeable value as the default in "python method overload"​

In python we can set the passed in parameter's default value to make the function has the same running feature as the method overload in Java. Define a function like this: def testFunction(self, param1, param2=None, param3=None): Normally we use "None" as the parameter's default value. We can also use str/bool as the default value, but is it OK we use empty list [] as its default value? This is our test program: """ A test program using empty list as the passed-in parameter's default value. ...

   PYTHON     2019-03-11 08:52:52

  memcpy() vs memmove() in C

memcpy() copies the bytes of data between memory blocks. If the block of memory overlaps, the function might not work properly. Use memmove() to deal with overlapping memory blocks. memmove() is very much like memcpy() but very flexible as it handles overlapping of memory blocks. example : char msg[50] = "abcdefghijklmnopqrstuvwxyz"; char temp[50]; main() { strcpy(temp, msg); printf("Original Msg = %s\n",temp); memcpy(temp+4, temp+16, 10); printf...

   Memory,memcpy,memmove,C,comparison,diffe     2011-04-14 09:05:10

  An experience of fixing a memory-corruption bug

During the last 4 months, I was disturbed by a memory-corruption bug, and this bug will cause program crash. Until last Monday, I found the root cause and fixed it. This debug process is a difficult but memorable experience, so I will share it in this article.   My program works as a SMS Hub. When it receives a SMS, it will allocate a structure in heap memory like this: typedef struct { ...... int *a[8]; ...... } info; After processing the SMS, the program will free the m...

   c, debug, unix, solaris, multi-thread     2014-05-04 03:52:43