Re: Jemalloc SEGV for 1MB chunk



On Wed, 28 Jan 2009, Channa wrote:

C>Hi All,
C>I am using jemalloc.c source from FreeBSD-current source.
C>When i allocate 1MB of memory using malloc() and use it as the below
C>test shows
C>
C>#include <stdio.h>
C>#include <stdlib.h>
C>#include <string.h>
C>
C>int main()
C>{
C> int i;
C> char *buf;
C> size_t size = 1048576 ;
C>
C> buf = malloc(size);
C> for (i = 0; i < 1048576; i++)
C> buf[i] = 'a';
C> printf("The length of buff is : %d\n",strlen(buf));
C> free(buf);
C> return 0;
C>}
C>
C>When i try to call strlen(buf) SEGV is recived.

Would be better to terminate the string with a '\0' so that it is really a
string.

harti

C>
C>This behaviour is seen when only for 1MB chunk if i allocate
C>memory lesser than 1MB no issues noticed.
C>
C>Could anyone see similar problem?
C>Is the above test wrong?
C>Or some issue with huge memory allocation in jemalloc?
C>
C>Your response will be very helpful.
C>
C>Thanks & Regards,
C>Channa
C>_______________________________________________
C>freebsd-current@xxxxxxxxxxx mailing list
C>http://lists.freebsd.org/mailman/listinfo/freebsd-current
C>To unsubscribe, send any mail to "freebsd-current-unsubscribe@xxxxxxxxxxx"
C>
C>
_______________________________________________
freebsd-current@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Blowfish encryption
    ... the source string will be padded to the next ... correct for Harbour/HWGUI but for good old 16 bit Clipper it ... allocate up to 64K, so any data/field longer than this will fail. ... an unrecoverable error 5304 (conventional memory exhausted). ...
    (comp.lang.clipper)
  • Re: Function speed, which is fast
    ... what is happening is the string is getting resized and memory allocation ... or you could create a dynamic memory chuck pointed via a PCHAR.. ... allocate like a 100K byte Pchar buffer. ... > function examines every single character of the plain text file. ...
    (comp.lang.pascal.delphi.misc)
  • Re: This is getting really weird.
    ... I thought 4 bytes for reference count and 4 for string length. ... > There should be no memory allocation for that line. ... > manager may allocate more space than requested for its own efficiency. ... > that New returned with a pointer to the string constant. ...
    (alt.comp.lang.borland-delphi)
  • Re: Unknown Crashing...
    ... each) and allocate that much memory. ... if the string given for Station is sizeofor more ... This copies the string from the Station array to itself. ...
    (comp.lang.c.moderated)
  • Re: This is getting really weird.
    ... > You say, one has to allocate a string, ok I do that like so: ... There should be no memory allocation for that line. ... manager may allocate more space than requested for its own efficiency. ... pointer to that heap space in Storage. ...
    (alt.comp.lang.borland-delphi)