malloc_size can't determine clipboard content size

I'm trying to detect the size of an object in the clipboard. I tried:

UIPasteBoard *pb = [UIPasteboard generalPasteboard];
for(NSDictionary *myDictionary in [pb items]){
    NSLog(@"%zu", malloc_size((__bridge const void *)(myDictionary)));

The problem is that this returns a similar number whether there's one word (plain text) in the clipboard or a movie!

How can I find a a reliable size for the objects in the clipboard?


In this case, malloc_size only includes the "structure" of the NSDictionary, not any memory it allocates and keeps pointers to. In short, malloc_size is pretty useless for this purpose.

To get a sense of the size of the object(s) on the pasteboard you could try this:

UIPasteboard* pb = [UIPasteboard generalPasteboard];
NSUInteger totalSize = 0;
for (NSString* type in pb.pasteboardTypes)
    NSData* data = [pb dataForPasteboardType: type];
    totalSize += data.length;

Need Your Help

Comparing string differences to a list of strings

python string list

I have a method, that computes the number of differences in two strings, and outputs where the differences are.

Storytelling Scrolling

javascript html scroll

Can someone please identify how this site has the effect of sliding through pages? Mainly how it pulls down one page up and onto another. Is it Javascript? I think it is very well done.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.