segmentation

What segments does C compiled program use?

Hi, I read on OSDev wiki, that protected mode of x86 architecture allow you to create separate segments for code and data, while you cannot write into code section. That Windows (yes, this is the platform) loads new code into code segment, and data are created on data segment. But, if this is the case, how does program know it must switc...

From my code, I can't trace the out of bounds exception.

public override Models.CalculationNode Parse(string expression) { var calNode = new Models.CalculationNode(); int i = expression.Length; char[] x = expression.ToCharArray(); string temp = ""; //Backwards assembly of the tree //Right Node while (!IsOperator(x[i]) && i > 0) { if (!x[i].Equals(' ')...

CMS + Individual content segments + segmentation based on parameters + REST api

Hey, Does anyone know of a CMS system that allows business users to create content assets, parameters for segmentation purposes and then have the asset available to pull down via a REST api? The segmentation would be based off of time-of-day, location and various custom parameters. I would like to be able to make one API call (with pa...

Help with infrequent segmentation fault in accessing boost::unordered_multimap or struct

I'm having trouble debugging a segmentation fault. I'd appreciate tips on how to go about narrowing in on the problem. The error appears when an iterator tries to access an element of a struct Infection, defined as: struct Infection { public: explicit Infection( double it, double rt ) : infT( it ), recT( rt ) {} double infT; // in...

c++ STL queues, references and segmentation fault

Newbie to C++ learning by converting a java program to c++. The following code results in a segmentation fault (SIGSEGV) when executed. //add web page reference to pages queue (STL) void CrawlerQueue::addWebPage(WebPage & webpage) { pagesBuffer.push(webpage); } //remove and return web page reference from pages queue WebPage & Crawl...

x86-64 and far calls / jumps

Quick summary: in x86-64 mode, are far jumps as slow as in x86-32 mode? On the x86 processor, jumps fall into three types: short, with a PC-offset of +/-127 bytes (2 byte instruction) near, with a +/- 32k offset that "rolls around" the current segment (3 byte instruction) far, which can jump anywhere (5 byte instruction) short and n...

C++ Class Pointer Deletion (Segmentation Fault Issue)

SOLVED Well, it seems that I'm receiving a segmentation fault when I try deleting my class pointer. I've tried many things, but yet haven't got it to work. Anyways, here is my main.cpp: (this segmentation fault is occurring when I delete 'm') /* * Copyright(c)Fellixombc 2010 * * TextToSqlRs is free software: you can redistribut...

Pure segmentation

I'm a bit confused about pure segmentation due to in my head always existed the idea of virtual memory. But as I understand pure segmentation is also imagining a virtual address space, divided in segments that are ALL loaded in RAM. The difference with virtual memory with segmentation, is that possibly there's some segment that it's no...

using clone(): segmentation fault

Hi, I want to use clone to log the current status of my program. It has a lot of loops and I want to keep track of the process without printing the status in each loop iteration. That's why I created this proof-of-concept: #include <iostream> #include <cstdlib> unsigned int i; int log(void*) { std::cout << "LOGGING START" << std::...

Assembler: How are segments used in 32bit systems?

From what I know, back in the days of 16bit PC's we had the Segment registers contain the address of each type of segment and you could access an offset with something like this SS:[EDI], this would take the value contained in EDI as an offset to the Stack Segment. Now I know that in 32bit systems, we have the GDT (Global Descriptor Ta...

How to split a string into words. Ex: "stringintowords" -> "String Into Words" ?

What is the right way to split a string into words ? (string doesn't contain any spaces or punctuation marks) For example: "stringintowords" -> "String Into Words" Could you please advise what algorithm should be used here ? ! Update: For those who think this question is just for curiosity. This algorithm could be used to camеlcase do...

Google Analytics content segmentation.

The content on my website is about food recipes. I wanted to track the content by two categories only: main courses, and salads. So I created two advanced segments in Google Analytics, and categorized it by how the URL starts with. Now to see the segments, I always need to go to My Customizations > Advanced Segments and choose the desire...

How to use glDrawVertex() function in ANSI C

Hello :) I'm learning OpenGL, and now usage of function glDrawArrays() but I always get Segmntation fault on glDrawArrays call, i'm doing something wrong? /*MESH*/ struct Mesh { GLsizei numVertices; GLfloat vertices[48]; } m; static void meshCreate(struct Mesh *mesh) { mesh->vertices[0] = 0.000000f; mesh->vertices[1] = -0.000000f;...

threshold algorithm

Does anyone know of any reference or sample code of the "Minimum Error Thresholding" algorithm? Java has a method called "getMinErrorThreshold" in the Histogram class and I want to implement this algorithm in C. Thank you Alessandro Ferrucci ...

Intensity Histogram threshold algorithm in JAI

JAI's Histogram class has a method called "getMinErrorThreshold" that corresponds to some known algorithm. I would like to implement this algorithm in C given a Histogram object of my own and have failed to find sample pseudocode or code that implements this algorithm (or even a detailed description of how the algorithm computes the thr...

How to divide players into divisions?

Lets say we have a two players game, where one player always wins (there can't be draw). The question is: How to divide n players into k divisions if we don't know anything about their skills? Each division should consist of the same number of players, and the best players players should be in first division, worst players in last divis...

Understanding scanf() in C (Seg Fault)

I don't understand getting input in C. I have the following code which is producing a segmentation fault: int main(int argc, char *argv[]){ while (fgets(buffer, MAX_LEN + 1, input) != NULL) { get_command(t, buffer); } return 0; } and static void get_command(Table *t, char *command) { COMMAND command_name = 0; char *valid_...

Malloc, free and segmentation fault

Hi, I don't understand why, in this code, the call to "free" cause a segmentation fault: #include <stdio.h> #include <string.h> #include <stdlib.h> char *char_arr_allocator(int length); int main(int argc, char* argv[0]){ char* stringa = NULL; stringa = char_arr_allocator(100); printf("stringa address: %p\n", stringa);...

combined paging and segmentation

Actually I'm little more interested about paging and segmentation of memory management of Operating system. I know little about paging and segmentation. Modern OS used combined paging and segmentation. but my question is how they do? what is the modern concept of memory management of operating system? ...