• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: preventing bad memory access
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: preventing bad memory access


  • Subject: Re: preventing bad memory access
  • From: Wilker <email@hidden>
  • Date: Thu, 20 Oct 2011 20:19:11 -0700

Thanks for the answers guys.

I mean I will use the f* operations.

But they are really safe? There is anything that I can do for extreme
situations in case to avoid bad memory access?
---
Wilker LĂșcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600



On Thu, Oct 20, 2011 at 12:09 AM, Don Quixote de la Mancha <
email@hidden> wrote:

> On Tue, Oct 18, 2011 at 9:22 AM, Jens Alfke <email@hidden> wrote:
> > On Oct 17, 2011, at 9:26 PM, Wilker wrote:
> > if the user is acessing a
> >> file from an external drive, and the file has 8gb, I only wanna read
> 64kb,
> >> so, I don't wanna read it all just for 64kb.
> >
> > Just use fopen/fseek/fread/fclose. Mapping in the entire file just so you
> can read 64kb is overkill.
>
> Specifically, if you fseek to the beginning of where you want to read,
> then fread what you want, the only part that will get cached is what
> you read.  It will be faster than not caching.
>
> mapping the file then reading from memory also caches parts of the
> file, but only what you read.
>
> If you're going to read your file in large chunks then it will be
> faster to use the open(), lseek(), read() and close() system calls.
> The "f" calls from stdio use an in-process cache which is faster for
> small accesses but slower for large ones.
>
>
> --
> Don Quixote de la Mancha
> Dulcinea Technologies Corporation
> Software of Elegance and Beauty
> http://www.dulcineatech.com
> email@hidden
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: preventing bad memory access
      • From: Don Quixote de la Mancha <email@hidden>
    • Re: preventing bad memory access
      • From: Jens Alfke <email@hidden>
References: 
 >preventing bad memory access (From: Wilker <email@hidden>)
 >Re: preventing bad memory access (From: Jens Alfke <email@hidden>)
 >Re: preventing bad memory access (From: Don Quixote de la Mancha <email@hidden>)

  • Prev by Date: Re: WebView doesn't scroll
  • Next by Date: Re: preventing bad memory access
  • Previous by thread: Re: preventing bad memory access
  • Next by thread: Re: preventing bad memory access
  • Index(es):
    • Date
    • Thread